#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lld = long double;
using vi = vector<int>;
using vll = vector<long long>;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int c[k];
  for (int i = 0; i < k; i++) {
    c[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    c[s[i] - 'A']++;
  }
  int m = 1e9;
  for (int i = 0; i < k; i++) {
    m = min(c[i], m);
  }
  cout << k * m;
}
