#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 1e6 + 4;
int fa[26];
int main() {
  int n, k;
  scanf("%d", &n);
  scanf("%d", &k);
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    fa[s[i] - 'A']++;
  }
  int ans = fa[0];
  for (int i = 0; i < k; i++) ans = min(ans, fa[i]);
  printf("%d", k * ans);
}
