#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int min1 = 9999999;
  int alpha[26] = {0};
  int len = s.length();
  for (int i = 0; i < len; i++) {
    alpha[s[i] - 65]++;
  }
  for (int i = 0; i < k; i++) {
    min1 = min(min1, alpha[i]);
  }
  cout << min1 * k << endl;
}
