#include <bits/stdc++.h>
using namespace std;
const int N = 2 * (int)1e5 + 100;
int n, k;
char a[N];
int main() {
  scanf("%d %d", &n, &k);
  scanf("%s", a);
  int tmp = 0, result = 0, ans = 0;
  for (int i = 0; i < 26; i++) {
    char ch = 'a' + i;
    tmp = 0;
    result = 0;
    for (int j = 0; j <= n; j++) {
      if (a[j] == ch) {
        tmp++;
      } else {
        result += tmp / k;
        tmp = 0;
      }
    }
    ans = max(ans, result);
  }
  printf("%d\n", ans);
  return 0;
}
