#include <bits/stdc++.h>
using namespace std;
const long long int mod = 999911658;
const int N = 2500005;
inline int read() {
  int x = 0, k = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') k = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x * k;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int a[100005];
map<int, int> mp;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  int k;
  cin >> k;
  cin >> s;
  int len = 0;
  int minn = 0x3f3f3f3f;
  for (int i = 0; i < n; i++) {
    a[i] = s[i] - 'A';
    mp[a[i]]++;
  }
  for (int i = 0; i < k; i++) {
    minn = min(minn, mp[i]);
  }
  cout << minn * k << endl;
}
