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