#include <bits/stdc++.h>
using namespace std;
void io() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(time(0));
}
int main() {
  io();
  int n, k, ans = 1000000000;
  vector<int> a(30);
  cin >> n >> k;
  string s;
  cin >> s;
  for (int i = 0; i < n; ++i) {
    a[s[i] - 'A']++;
  }
  for (int i = 0; i < k; ++i) {
    ans = min(ans, a[i]);
  }
  cout << ans * k;
  return 0;
}
