#include <bits/stdc++.h>
const int INF = 0x7fffffff;
const long long INF_LL = (long long)1e18;
const int maxn = 1e5 + 10;
using namespace std;
int n, k;
string s;
int cnt[30];
int main() {
  scanf("%d%d", &n, &k);
  cin >> s;
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < n; i++) {
    int x = s[i] - 'A';
    cnt[x]++;
  }
  int ans = INF;
  for (int i = 0; i < k; i++) {
    ans = min(ans, cnt[i]);
  }
  cout << ans * k << "\n";
  return 0;
}
