#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int sub_len = 0;
  map<char, vector<int>> sub_lens;
  for (int i = 0; i < s.size(); i++) {
    if (i and s[i] == s[i - 1]) {
      sub_len++;
    } else {
      if (i) {
        if (not sub_lens.count(s[i - 1])) sub_lens[s[i - 1]] = vector<int>();
        sub_lens[s[i - 1]].push_back(sub_len);
      }
      sub_len = 1;
    }
  }
  sub_lens[s.back()].push_back(sub_len);
  int ans = 0;
  for (auto [c, lens] : sub_lens) {
    int x = 0;
    for (int len : lens) {
      x += len / k;
    }
    ans = max(ans, x);
  }
  cout << ans << endl;
  return 0;
}
