#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int arr[2000];
  memset(arr, 0, sizeof(arr));
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) arr[s[i]]++;
  int m = 10000000;
  for (int i = 65; i < 65 + k; i++) m = min(arr[i], m);
  cout << m * k;
}
