#include <bits/stdc++.h>
using namespace std;
double eps = 1e-9;
int inf = 1000000005;
int mod = 1000000007;
long long INFF = 1000000000000000005ll;
double PI = acos(-1);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
void cp() {}
inline string IntToString(long long a) {
  char x[100];
  sprintf(x, "%lld", a);
  string s = x;
  return s;
}
inline long long StringToInt(string a) {
  char x[100];
  long long res;
  strcpy(x, a.c_str());
  sscanf(x, "%lld", &res);
  return res;
}
inline string GetString(void) {
  char x[1000005];
  scanf("%s", x);
  string s = x;
  return s;
}
inline string uppercase(string s) {
  int n = (int)s.size();
  int i;
  for (i = (0); i < (n); ++i)
    if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
  return s;
}
inline string lowercase(string s) {
  int i;
  int n = (int)s.size();
  for (i = (0); i < (n); ++i)
    if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
  return s;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int i, j, k;
  int t;
  int n;
  string s;
  cin >> n >> k >> s;
  int x = 0, num;
  int a[30] = {0};
  for (i = (0); i < (s.size()); ++i) {
    a[s[i] - 'A']++;
    num = s[i] - 'A';
    x = max(x, num);
  }
  if (x == k - 1) {
    x = n;
    for (i = (0); i < (k); ++i) {
      x = min(x, a[i]);
    }
    cout << k * x << endl;
  } else
    cout << "0\n";
  return 0;
}
