#include <bits/stdc++.h>
using namespace std;
char s[100000 + 10];
int main() {
  int cnt[30], n, k;
  memset(cnt, 0, sizeof(cnt));
  scanf("%d %d %s", &n, &k, s);
  int len = strlen(s);
  for (int i = 0; i < len; i++) cnt[s[i] - 65]++;
  int minn = 1e5 + 10;
  for (int i = 0; i < k; i++) minn = min(minn, cnt[i]);
  cout << minn * k << endl;
  return 0;
}
