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