#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7;
const int MAX_N=10000;
int n,k,a[27]={};
string s;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> k;
	REP(i,0,n){
		cin >> s;
		a[s[0]-'A']++;
	}
	
	bool used[26]={}; a[26]=-1;
	int ma,s,c=0;
	while(true){
		s=0; memset(used,false,sizeof(used));
		REP(j,0,26) if(a[j]) s++;
		if(s<k) break;
		REP(i,0,k){
			ma=26;
			REP(j,0,26) if(a[j]>0 and a[j]>a[ma] and (not used[j])) ma=j;
			used[ma]=true; a[ma]--;
		}
		c++;
	}
	
	cout << c << endl;
	return 0;
}
