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