#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, k, i, j;
  cin >> n >> k;
  int a[k];
  memset(a, 0, sizeof(a));
  cin >> s;
  for (i = 0; i < s.size(); i++) {
    j = (int)s[i] - 65;
    a[j]++;
  }
  int m = INT_MAX;
  for (i = 0; i < k; i++) m = min(m, a[i]);
  cout << m * k << endl;
  return 0;
}
