#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  map<int, int> mp;
  vector<char> v;
  string s;
  cin >> n >> k >> s;
  for (int i = 0; i < s.size(); i++) {
    mp[s[i]]++;
    if (find(v.begin(), v.end(), s[i]) == v.end()) v.push_back(s[i]);
  }
  if (v.size() != k) {
    cout << 0 << endl;
    return 0;
  }
  long long mn = 100000000;
  for (int i = 0; i < v.size(); i++) {
    if (mp[v[i]] < mn) mn = mp[v[i]];
  }
  cout << mn * k << endl;
  return 0;
}
