#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, k, i, a[27] = {0}, cnt = 9999999;
  cin >> n >> k >> s;
  for (i = 0; i < n; i++) {
    a[s[i] - 'A']++;
  }
  for (i = 0; i < k; i++) {
    if (a[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  for (i = 0; i < k; i++) {
    cnt = min(cnt, a[i]);
  }
  cout << cnt * k << endl;
  return 0;
}
