#include <bits/stdc++.h>
using namespace std;
int main() {
  map<string, int> mymap;
  string str, temp = "";
  int n, k, maxVal = 0;
  cin >> n >> k >> str;
  for (auto i : str) {
    if (temp.back() == i)
      temp += i;
    else
      temp = i;
    if (temp.length() == k) {
      int x = ++mymap[temp];
      maxVal = max(maxVal, x);
      temp = "";
    }
  }
  cout << maxVal;
}
