#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k, ans = 0;
  cin >> n >> k;
  string s;
  cin >> s;
  map<char, int> mp;
  int i = 0, j = 1;
  for (; i < n; ++i) {
    int cnt = 1;
    for (j = i + 1; j < n && s[j] == s[i]; ++j) cnt++;
    mp[s[i]] += cnt / k;
    i = j - 1;
  }
  int mx = 0;
  for (char c = 'a'; c <= 'z'; ++c) mx = max(mx, mp[c]);
  cout << mx;
}
