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