#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, ans = 0;
  char s[200100];
  cin >> n >> k >> s;
  for (i = 0; i < 26; i++) {
    char sp = 'a' + i;
    int st = 0, lj = 0;
    while (st < n) {
      while (s[st] != sp && st < n) st++;
      if (st >= n) break;
      int tp = 1;
      while (s[st + 1] == s[st] && st < n) {
        tp++;
        st++;
      }
      lj += (tp / k);
      st++;
    }
    ans = max(ans, lj);
  }
  cout << ans;
  return 0;
}
