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