#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 1;
const long long INF = 1e9 + 1;
const long long MOD = 1e9;
const long long BITS = 64;
const long double EPS = 1e-12;
void bye() {
  cout << "\n";
  exit(0);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> cnt(k);
  for (int i = 0; i < (long long)(s).size(); i++) {
    cnt[s[i] - 'A']++;
  }
  cout << *min_element((cnt).begin(), cnt.end()) * k;
  bye();
}
