#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, cnt = INT_MAX, c = 0;
  cin >> n >> k;
  string s, temp = "";
  cin >> s;
  int freq[26];
  memset(freq, 0, sizeof(freq));
  for (int i = 0; i < n; i++) freq[s[i] - 'A']++;
  for (int i = 0; i < k; i++) {
    if (!freq[i]) return cout << 0 << endl, 0;
    cnt = min(cnt, freq[i]);
  }
  cout << cnt * k << endl;
}
