#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
const int N = 2e5 + 50;
char s[N], s2[N];
int main()
{
    int n, k, ans = 0;
    scanf("%d%d%s", &n, &k, &s);
    for (char ch = 'a'; ch <= 'z'; ch++)
    {
        int cnt = 0;
        for (int i = 0; i < k; i++) s2[i] = ch;
        for (int i = 0; i <= n - k;)
            if (memcmp(s + i, s2, k) == 0)
                cnt++, i += k;
            else
                i++;
        ans = max(ans, cnt);
    }
    printf("%d", ans);
    return 0;
}
