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