#include <bits/stdc++.h>
using namespace std;
int fb[5050];
int main() {
  int n, k;
  int a[26] = {0};
  char s[100005];
  while (cin >> n >> k >> s) {
    for (int i = 0; i < n; ++i) {
      a[s[i] - 'A']++;
    }
    int minn = n;
    for (int i = 0; i < k; ++i) minn = min(minn, a[i]);
    cout << k * minn << endl;
  }
}
