#include <bits/stdc++.h>
using namespace std;
int say = 0, lng = 0, d[200], m, k, mx = 200005;
int main() {
  scanf("%d %d", &m, &k);
  for (int i = 0; i < m; ++i) {
    char c;
    scanf(" %c", &c);
    d[c]++;
  }
  for (char i = 'A'; i < 'A' + k; ++i) {
    mx = min(mx, d[i]);
  }
  printf("%d\n", mx * k);
}
