#include <bits/stdc++.h>
using namespace std;
int main() {
  string zodis;
  int kiekis, raides, k = 0;
  int Min = 100000;
  cin >> kiekis >> raides;
  cin >> zodis;
  for (char i = 65; i < 65 + raides; i++) {
    for (int j = 0; j < kiekis; j++) {
      if (zodis[j] == i) k++;
    }
    if (Min >= k) Min = k;
    k = 0;
  }
  cout << Min * raides;
  return 0;
}
