#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  map<char, int> mymap;
  for (int i = 0; i < k; i++) {
    int j = i + 65;
    char ch = (char)j;
    mymap[ch] = 0;
  }
  for (int i = 0; i < s.size(); i++) {
    mymap[s[i]]++;
  }
  int min = INT_MAX;
  for (int i = 0; i < k; i++) {
    int j = i + 65;
    char ch = (char)j;
    if (mymap[ch] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  for (int i = 0; i < k; i++) {
    int j = i + 65;
    char ch = (char)j;
    if (mymap[ch] < min) {
      min = mymap[ch];
    }
  }
  cout << min * k << endl;
  return 0;
}
