#include <bits/stdc++.h>
using namespace std;
char str[100005];
int cnt[50];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  scanf("%s", str + 1);
  for (int i = 1; i <= n; i++) {
    cnt[(int)(str[i] - 'A')]++;
  }
  int minn = 0x3f3f3f3f;
  for (int i = 0; i < k; i++) minn = min(minn, cnt[i]);
  printf("%d\n", minn * k);
  return 0;
}
