#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
using namespace std;
const long long inf = 1e18;
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<long long> v(k, 0);
  for (long long i = 0; i < n; ++i) {
    v[s[i] - 'A']++;
  }
  long long m = inf;
  for (long long i = 0; i < k; ++i) {
    if (v[i] < m) {
      m = v[i];
    }
  }
  cout << m * k;
  return 0;
}
