#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    string c,s;
    int n,k,q[101]={},sum=0,x,ans=0;
    ios::sync_with_stdio(false);
    cin>>n>>k;
    for (int i=1; i<=n; i++)
    {
        cin>>c;
        q[c[0]]++;
        sum++;
        //cout<<c[0]<<endl;
    }
    //for (int i=65; i<=90; i++)
    //    cout<<q[i]<<endl;
    while (sum>0)
    {
        x=0;
        sort(begin(q),end(q),greater<int>());
        if (q[k-1]==0) break;
        for (int i=0; i<k; i++)
        {
            q[i]--;
                    //cout<<ans<<endl;
        }
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}