#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7, inf = 1e18;
long long modpow(long long n, long long p, long long m) {
  long long ret = 1;
  while (p > 0) {
    if (p & 1) ret = (ret * n) % m;
    p >>= 1;
    n = (n * n) % m;
  }
  return ret;
}
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  vector<int> cnt(256, 0);
  for (int i = 0; i < n; ++i) {
    cnt[s[i]] += 1;
  }
  int ans = n;
  for (int i = 65; i < 65 + k; ++i) {
    ans = min(ans, cnt[i]);
  }
  cout << ans * k << endl;
}
