#include <bits/stdc++.h>
using std::cin;
using std::cout;
int n, k;
int frq['z' + 10];
int main() {
  cin >> n >> k;
  int len = 0;
  char prev = '\0';
  for (int i = 0; i < n; i++) {
    char chr;
    cin >> chr;
    if (chr == prev)
      len++;
    else {
      frq[prev] += len / k;
      prev = chr;
      len = 1;
    }
  }
  frq[prev] += len / k;
  int sol = 0;
  for (char i = 'a'; i <= 'z'; i++)
    if (frq[i] > sol) sol = frq[i];
  cout << sol << '\n';
  return 0;
}
