#include <bits/stdc++.h>
using namespace std;
void err() { cout << '\n'; }
template <typename T, typename... More>
void err(T arg, More... more) {
  cout << arg << ' ';
  err(more...);
}
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> arr(26);
  for (char c : s) {
    arr[c - 'A']++;
  }
  int mn = 1e6;
  for (__typeof(k) i = (0) - (0 > k); i != (k) - (0 > k);
       i += 1 - 2 * (0 > k)) {
    mn = min(mn, arr[i]);
  }
  cout << k * mn << '\n';
  return 0;
}
