#include <bits/stdc++.h>
int cnt[30];
int n, k;
char a[200005];
int main() {
  scanf("%d %d", &n, &k);
  scanf(" %s", &a[1]);
  char prev = 0;
  int conseq = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == prev) {
      conseq++;
    } else {
      prev = a[i];
      conseq = 1;
    }
    if (conseq == k) {
      cnt[prev - 'a']++;
      prev = 0;
      conseq = 0;
    }
  }
  int ans = 0;
  for (int i = 0; i < 26; i++) {
    if (ans < cnt[i]) ans = cnt[i];
  }
  printf("%d", ans);
  return 0;
}
