#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  map<char, int> m;
  cin >> s;
  vector<int> a(k, 0);
  for (char c : s) {
    a[c - 'A']++;
  }
  sort(a.begin(), a.end());
  cout << a[0] * k;
  return 0;
}
