#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<char> alpha = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
                        'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
                        'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
  vector<char> elms(alpha.begin(), alpha.begin() + k);
  string s;
  cin >> s;
  vector<int> cnt;
  for (auto x : elms) {
    cnt.push_back(count(s.begin(), s.end(), x));
  }
  if (find(cnt.begin(), cnt.end(), 0) != cnt.end()) {
    cout << 0 << endl;
  } else {
    cout << (*min_element(cnt.begin(), cnt.end()) * k) << endl;
  }
}
