#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 5000;
char s[maxn];
long long n, k;
map<char, long long> mp;
signed main() {
  cin >> n >> k;
  cin >> s;
  long long ct = 1;
  for (long long i = 1; i < n; i++) {
    if (ct == k) {
      mp[s[i - 1]]++;
      ct = 0;
    }
    if (s[i] == s[i - 1])
      ct++;
    else
      ct = 1;
  }
  if (ct == k) mp[s[n - 1]]++;
  map<char, long long>::iterator it;
  long long ans = 0;
  for (it = mp.begin(); it != mp.end(); it++) {
    if (it->second > ans) ans = it->second;
  }
  cout << ans << endl;
  return 0;
}
