#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1000;
const long long inf = 1000 * 1000 * 1000 + 7;
const long long INFINF = 900372036854;
int cnt[256], cnt2[256];
int main() {
  int n, k;
  cin >> n >> k;
  string a;
  cin >> a;
  for (int i = 0; i < n; ++i) cnt[a[i]]++;
  for (int i = 0; i < n; ++i) {
    if (int(a[i]) <= k + 65) cnt2[a[i]]++;
  }
  int pp = 1e6;
  for (int i = 0; i < 256; ++i) {
    if (cnt2[i] >= 0 && i >= 65 && i < 65 + k) pp = min(pp, cnt2[i]);
  }
  if (pp == 1e6) pp = 0;
  cout << pp * k;
  return 0;
}
