#include <bits/stdc++.h>
using namespace std;
const long long ool = (long long)1e18;
const int oo = (int)1e9 + 7;
const int N = (int)1e5 + 1;
const int N6 = (int)1e6 + 1;
const int N3 = (int)1e3 + 1;
const int N4 = (int)1e4 + 1;
const long double EPS = 1e-6;
int cntbit(int s) { return __builtin_popcount(s); }
int getbit(int s, int i) { return (s >> i) & 1; }
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int lcm(int a, int b) { return (a / gcd(a, b)) * b; }
bool used[N + 5];
string s;
int n, k, mn = oo;
map<char, int> m;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  cin >> s;
  for (int i = 0; i < s.size(); ++i) m[s[i]]++;
  for (char i = 'A'; i < 'A' + k; ++i) {
    mn = min(m[i], mn);
  }
  cout << endl << mn * k;
  return 0;
}
