#include <bits/stdc++.h>
using namespace std;
const long long MOD = (1e9 + 7);
int v[100004];
int main() {
  int n, k;
  cin >> n >> k;
  string txt;
  cin >> txt;
  for (int i = 0; i < k; ++i) {
    v[i] = 0;
  }
  for (int i = 0; i < txt.size(); ++i) {
    v[txt[i] - 'A']++;
  }
  int minn = 1e9;
  for (int i = 0; i < k; ++i) minn = min(minn, v[i]);
  cout << minn * k << endl;
}
