#include <bits/stdc++.h>
const int N = 200010;
char s[N];
int main() {
  int n, k;
  scanf("%d%d%s", &n, &k, s);
  int max = 0;
  for (int i = 0; i < 26; ++i) {
    int pre = 0;
    int cnt = 0;
    for (int j = 0; j <= n; ++j) {
      if (s[j] != i + 'a') {
        cnt += (j - pre) / k;
        pre = j + 1;
      }
    }
    max = std::max(max, cnt);
  }
  printf("%d\n", max);
  return 0;
}
