#include <bits/stdc++.h>
using namespace std;
int cnt[30];
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int ccnt = 1, mx = 0;
  if (ccnt == k) {
    int tmp = s[0] - 'a';
    cnt[tmp]++;
    ccnt = 0;
  }
  for (int i = 1; i < n; i++) {
    if (s[i] == s[i - 1])
      ccnt++;
    else
      ccnt = 1;
    if (ccnt == k) {
      int tmp = s[i] - 'a';
      cnt[tmp]++;
      ccnt = 0;
    }
  }
  for (int i = 0; i <= 26; i++) {
    mx = max(mx, cnt[i]);
  }
  cout << mx << endl;
  return 0;
}
