#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using db = double;
const int N9 = 1e9 + 7;
const int N5 = 1e5 + 5;
const db PI = acos(-1);
void solve() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  vector<int> alp(26);
  for (int i = 0; i < ((int)(s).size()); i++) {
    alp[s[i] - 'A']++;
  }
  int res = INT_MAX;
  for (int i = 0; i < k; i++) {
    res = min(res, alp[i]);
  }
  cout << res * k;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(12);
  cout << fixed;
  int t = 1;
  while (t--) {
    solve();
    cout << '\n';
  }
  cerr << endl << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  return 0;
}
