#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
long long n, k, x = 0;
string s;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> k >> s;
  for (char ch = 'a'; ch <= 'z'; ch++) {
    long long curx = 0;
    for (long long i = 0; i < n; i++) {
      if (s[i] != ch) continue;
      long long j = i, len = 1;
      while (j + 1 < n && s[j + 1] == ch && len < k) {
        len++;
        j++;
      }
      if (len == k) curx++;
      i = j;
    }
    x = max(x, curx);
  }
  cout << x;
  return 0;
}
