#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 1;
string s;
int cnt[26];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  cin >> s;
  for (auto c : s) cnt[c - 'A']++;
  int ans = 1e9;
  for (int i = 0; i < k; i++) ans = min(ans, cnt[i]);
  cout << k * ans;
}
