#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> oc(k);
  for (long long i = 0; i < n; i++) oc[s[i] - 'A']++;
  int mn = 1000000000;
  for (auto &e : oc) mn = min(mn, e);
  cout << mn * k << endl;
  return 0;
}
