#include <bits/stdc++.h>
using namespace std;
const long long INF = 2000000000LL;
const long double EPS = 1e-9;
const int N = 200000 + 7;
string s;
map<char, int> mpp;
int main() {
  int n, k;
  cin >> n >> k;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    mpp[s[i]]++;
  }
  int mn = 1e9;
  for (char a = 'A'; a < 'A' + k; a++) {
    mn = min(mpp[a], mn);
  }
  cout << mn * k << endl;
  return 0;
}
