#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
struct F {
  char ch;
  int id;
} e[maxn];
bool mycmp(struct F a, struct F b) {
  if (a.ch != b.ch)
    return a.ch < b.ch;
  else
    return a.id < b.id;
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  getchar();
  for (int i = 1; i <= n; i++) {
    e[i].id = i;
    scanf("%c", &e[i].ch);
  }
  int ans = 0, sum = 0;
  sort(e + 1, e + 1 + n, mycmp);
  for (int i = 1, j = i + k - 1; j <= n; i++, j = i + k - 1) {
    if (i == 1 || e[i].ch != e[i - 1].ch) {
      ans = ans > sum ? ans : sum;
      sum = 0;
    }
    if (e[j].ch == e[i].ch && e[j].id - e[i].id == k - 1) {
      sum++;
      i = j;
    }
  }
  ans = ans > sum ? ans : sum;
  printf("%d\n", ans);
  return 0;
}
