#include <bits/stdc++.h>
using namespace std;
char s[100005];
int n, m, ans = 100005, num[30];
int main() {
  scanf("%d %d\n%s", &n, &m, s + 1);
  for (int i = 1; i <= n; i++) num[s[i] - 'A']++;
  for (int i = 0; i < m; i++) ans = min(ans, num[i]);
  printf("%d\n", ans * m);
  return 0;
}
