import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long MOD = 10^^9 + 7;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];
    auto S = readln.chomp;

    auto cnt = new int[](26);
    foreach (i; 0..N) cnt[S[i]-'A'] += 1;

    int ans = 1 << 29;
    foreach (i; 0..K) ans = min(ans, cnt[i]);

    writeln(ans * K);
}
