#include <bits/stdc++.h>
using namespace std;
int cmap[26];
string str;
int main() {
  ios::sync_with_stdio(0);
  int n, k;
  cin >> n >> k >> str;
  char currc = 'a';
  int camt = 0;
  for (int i = 0; i < 26; i++) cmap[i] = 0;
  for (int i = 0; i < n; i++) {
    if (str[i] != currc) {
      cmap[currc - 'a'] += camt / k;
      currc = str[i];
      camt = 0;
    }
    camt++;
  }
  cmap[currc - 'a'] += camt / k;
  int ans = 0;
  for (int i = 0; i < 26; i++) {
    ans = max(ans, cmap[i]);
  }
  cout << ans;
  return 0;
}
