#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long x, y;
  cin >> x >> y;
  string s;
  cin >> s;
  vector<long long> v;
  v.resize(y, 0);
  long long ans = 0;
  for (int i = 0; i < s.length(); i++) {
    v[s[i] - 65]++;
    long long ans1 = INT_MAX;
    for (long long j = 0; j < v.size(); j++) {
      ans1 = min(ans1, v[j]);
    }
    ans = max(ans, ans1);
  }
  cout << ans * y;
  return 0;
}
