#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
using ulong = unsigned long;
using ll = long long;
const int M = 1e9 + 7;

int n, k;
vector<int> az(300);
int solve(){
	for(int i=0;;i++){
		sort(az.begin(), az.end(), [](int l, int r){ return l > r; });
		for(int j=0;j<k;j++){
			if(az[j] == 0){ return i; }
			az[j]--;
		}
	}
}
int main(){
	cin >> n >> k;
	for(int i=0;i<n;i++){
		string p;
		cin >> p;
		az[p[0]]++;
	}
	cout << solve() << endl;
	return 0;
}

