#include <bits/stdc++.h>
using namespace std;
vector<int> G[30];
char STR[200001];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  cin >> STR;
  if (n == 1) {
    puts("1");
    return 0;
  }
  int head = 0, tail;
  tail = head + 1;
  while (tail < n) {
    char T = STR[head];
    while (STR[tail] == T) {
      tail++;
    }
    if (tail == n) {
      if (STR[tail - 1] == T) {
        int IDD = T - 'a';
        if (tail - head >= k) G[IDD].push_back(tail - head);
        head = tail;
      }
    }
    if (tail >= n) break;
    int IDD = T - 'a';
    if (tail - head >= k) G[IDD].push_back(tail - head);
    head = tail;
  }
  int MAX = 0;
  for (int i = 0; i < 26; i++) {
    if (G[i].size() == 0) continue;
    int sum = 0;
    for (int j = 0; j < G[i].size(); j++) {
      int VAL = G[i][j];
      sum += VAL / k;
    }
    MAX = max(MAX, sum);
  }
  printf("%d\n", MAX);
  return 0;
}
