#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long mod = 1e9 + 7;
const long long N = 2e5 + 10;
inline long long add(long long x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
inline long long mul(long long x, long long y) {
  x = (1LL * x * y) % mod;
  return x;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  long long maxv = 0;
  for (char ch = 'a'; ch <= 'z'; ch++) {
    char prev = '`';
    long long ans = 0;
    long long cc = 0;
    for (long long i = 0; i <= n - 1; ++i) {
      if (s[i] == prev)
        cc++;
      else {
        if (prev == ch) ans += cc / k;
        cc = 1;
        prev = s[i];
      }
    }
    if (prev == ch) ans += cc / k;
    maxv = max(maxv, ans);
  }
  cout << maxv;
  return 0;
}
