#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  long long ans = 0;
  for (long long i = 0; i < 26; i++) {
    long long here = 0;
    long long sum = 0;
    for (long long j = 0; j < n; j++) {
      if ((s[j] - 'a') == i) {
        here++;
      } else {
        sum += here / k;
        here = 0;
      }
    }
    sum += here / k;
    ans = max(ans, sum);
  }
  cout << ans;
  return 0;
}
