#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> freq(26, 0);
  for (int i = 0; i < n; i++) {
    freq[s[i] - 'A']++;
  }
  int min_freq = 1e9;
  for (int i = 0; i < k; i++) {
    min_freq = min(min_freq, freq[i]);
  }
  cout << min_freq * k << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int T;
  T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
