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