#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, l, max = INT_MAX, f = 0, i, n;
  cin >> n >> k;
  int h[26] = {0};
  string s;
  cin >> s;
  l = s.size();
  for (i = 0; i < l; i++) {
    if ((k - 1) == (s[i] - 'A')) {
      f = 1;
    }
    h[s[i] - 'A']++;
  }
  if (f == 1) {
    for (i = 0; i < k; i++) {
      if (h[i] < max) {
        max = h[i];
      }
    }
    cout << k * max;
  } else {
    cout << "0";
  }
}
