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