#include <bits/stdc++.h>
const double PI = acos(-1.0);
using namespace std;
int setb(int n, int pos) { return n = n | (1 << pos); }
int resb(int n, int pos) { return n = n & ~(1 << pos); }
bool checkb(int n, int pos) { return (bool)(n & (1 << pos)); }
inline long long bigmod(long long b, long long p, long long m) {
  long long ret = 1, cur = b % m;
  while (p) {
    if (p & 1) ret = (ret * cur) % m;
    cur = (cur * cur) % m;
    p = p >> 1;
  }
  return ret;
}
int n, k;
char str[1000005];
int cnt[100];
int main() {
  int i;
  scanf("%d %d", &n, &k);
  scanf("%s", str);
  for (int i = 0; i < n; i++) {
    cnt[str[i] - 'A']++;
  }
  int ret = 1e9;
  for (int i = 0; i < k; i++) ret = min(ret, cnt[i]);
  printf("%d", ret * k);
  printf("\n");
  return 0;
}
