#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  string str;
  scanf("%lld %lld", &n, &k);
  cin >> str;
  long long frq[1005];
  memset(frq, 0, sizeof(frq));
  for (long long i = 0; i < n; i++) {
    frq[str[i] - 64]++;
  }
  long long mn = 100000000000000;
  for (long long i = 1; i <= k; i++) {
    mn = min(mn, frq[i]);
  }
  printf("%lld\n", mn * k);
  return (0);
}
