#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  unordered_map<string, int> hmap;
  string temp = "";
  temp += s[0];
  char prev = s[0];
  int ans = 0;
  for (int i = 1; i < n; i++) {
    if (temp.length() == k) {
      if (hmap.find(temp) == hmap.end()) {
        hmap[temp] = 1;
        ans = max(ans, hmap[temp]);
      } else {
        hmap[temp]++;
        ans = max(ans, hmap[temp]);
      }
      temp = "";
    }
    if (temp.length() == 0) {
      temp += s[i];
    } else if (temp[temp.length() - 1] == s[i]) {
      temp += s[i];
    } else if (temp[temp.length() - 1] != s[i]) {
      temp = "";
      temp += s[i];
    }
  }
  if (temp.length() == k) {
    if (hmap.find(temp) == hmap.end()) {
      hmap[temp] = 1;
      ans = max(ans, hmap[temp]);
    } else {
      hmap[temp]++;
      ans = max(ans, hmap[temp]);
    }
    temp = "";
  }
  cout << ans;
  return 0;
}
