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