#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
char s[200005];
int A[26];
int main() {
  int n = read(), k = read();
  scanf("%s", s);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int tmp = i;
    while (s[i] == s[i + 1]) i++;
    A[s[i] - 'a'] += (i - tmp + 1) / k;
  }
  for (int i = 0; i < 26; i++) ans = max(ans, A[i]);
  printf("%d\n", ans);
  return 0;
}
