#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  map<char, int> cnt;
  int temp_cnt = 1;
  for (int i = 1; i < s.length(); i++) {
    if (s[i] == s[i - 1]) {
      temp_cnt++;
    } else {
      if (cnt.find(s[i - 1]) == cnt.end()) {
        cnt[s[i - 1]] = temp_cnt / k;
      } else {
        cnt[s[i - 1]] += temp_cnt / k;
      }
      temp_cnt = 1;
    }
  }
  if (cnt.find(s[s.length() - 1]) == cnt.end()) {
    cnt[s[s.length() - 1]] = temp_cnt / k;
  } else {
    cnt[s[s.length() - 1]] += temp_cnt / k;
  }
  int maxx = 0;
  for (auto it = cnt.begin(); it != cnt.end(); ++it) {
    maxx = max(maxx, it->second);
  }
  cout << maxx;
  return 0;
}
