#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string str;
  cin >> str;
  int arr[2500];
  int i = 0;
  while (str[i] != '\0') {
    arr[str[i] - 64]++;
    i++;
  }
  int min = 100000;
  int cnt = 0;
  for (int i = 1; i <= 26; i++) {
    if (arr[i] > 0) {
      cnt++;
    }
    if (arr[i] > 0 && arr[i] < min) min = arr[i];
  }
  if (cnt == k)
    cout << min * k;
  else
    cout << 0;
}
