#include <bits/stdc++.h>
using namespace std;
int n, k, a[10005];
string s;
int main() {
  cin >> n >> k >> s;
  int p[k];
  memset(p, 0, sizeof(p));
  for (char c : s) {
    p[c - 'A']++;
  }
  int mIn = 10000000;
  for (int i = 0; i < k; i++) {
    if (p[i] < mIn) mIn = p[i];
  }
  cout << mIn * k << endl;
  return 0;
}
