#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
int main() {
  ull n, k;
  cin >> n >> k;
  string str;
  cin >> str;
  ull count[k];
  for (ull i = 0; i < k; ++i) count[i] = 0;
  for (char letter : str) ++count[letter - 'A'];
  ull ans = n + 1;
  for (ull value : count) ans = min(ans, value);
  cout << k * ans << endl;
  return 0;
}
