#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int ans = INT_MIN;
  for (char i = 'a'; i <= 'z'; ++i) {
    int cnt = 0, tmp = 0;
    for (int j = 0; j < s.size(); ++j) {
      if (s[j] == i) {
        tmp++;
      } else
        tmp = 0;
      if (tmp == k) cnt++, tmp = 0;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
}
