#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string str;
  cin >> str;
  int max = 0;
  for (int i = 0; i < 26; i++) {
    int forl = 0, length = 0;
    for (int j = 0; j < n; j++) {
      if (str[j] != (i + 'a')) {
        forl += length / k;
        length = 0;
      } else
        length++;
    }
    forl += length / k;
    if (max < forl) max = forl;
  }
  cout << max;
  return 0;
}
