#include <bits/stdc++.h>
using namespace std;
map<char, int> num, ans;
int main() {
  int n, k, maxn = 0;
  string s;
  cin >> n >> k >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == s[i + 1]) num[s[i]]++;
    if (s[i] != s[i + 1]) {
      ans[s[i]] += (num[s[i]] + 1) / k;
      maxn = max(maxn, ans[s[i]]);
      num[s[i]] = 0;
    }
  }
  cout << maxn;
  return 0;
}
