#include <bits/stdc++.h>
using namespace std;
void sp(int &num) {
  num = 0;
  register int c;
  for (c = getchar(); c < 48 || c > 57; c = getchar()) {
  }
  for (; c >= 48 && c <= 57; c = getchar()) num = num * 10 + c - 48;
}
void sp(long long &num) {
  num = 0;
  register int c;
  for (c = getchar(); c < 48 || c > 57; c = getchar()) {
  }
  for (; c >= 48 && c <= 57; c = getchar()) num = num * 10 + c - 48;
}
const int N = 3e5 + 5;
char f[N];
int res, dem = 1, n, k, ans, cnt[N];
int main() {
  cin >> n >> k;
  cin >> f;
  for (int s = 0; s < n; s++) {
    if (s != 0)
      if (f[s] == f[s - 1]) dem++;
    if (s != 0)
      if (f[s] != f[s - 1]) dem = 1;
    if (s == 0) dem = 1;
    if (dem == k) {
      dem = 0;
      cnt[f[s]]++;
      res++;
    }
  }
  for (int i = 1; i <= 300; i++) ans = max(ans, cnt[i]);
  cout << ans;
}
