#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int alp[26];
int main(){
 int n,k;cin>>n>>k;
  for(int i = 0; n > i; i++){
    string s;cin>>s;
    alp[s[0]-'A']++;
  }
  vector<int> a;
  for(int i = 0; 26 > i; i++){
    if(alp[i]){
      a.push_back(alp[i]);
    }
  }
  sort(a.begin(),a.end(),greater<int>());
  int ans = 0;
  while(a.size() >= k){
    for(int i = 0; k > i; i++)a[i]--;
    ans++;
    sort(a.begin(),a.end(),greater<int>());
    while(a[a.size()-1] == 0 && !a.empty())a.pop_back();
  }
  cout << ans << endl;
}