#include <bits/stdc++.h>
using namespace std;
int t[3000];
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    t[s[i]] += 1;
  }
  int lk = t['A'];
  for (char c = 'A'; c < 'A' + k; c++) {
    if (t[c] < lk) {
      lk = t[c];
    }
  }
  cout << lk * k;
  return 0;
}
