#include <bits/stdc++.h>
using namespace std;
int Month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int A[1000 + 1];
int B[126];
void omae_wa_mou_shindeiru() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  for (int i = 0; i < n; ++i) {
    int c = 1;
    while (s[i] == s[i + 1] && i < n) {
      ++c;
      ++i;
    }
    B[s[i]] += c / k;
  }
  int ans = 0;
  for (int i = 'a'; i <= 'z'; ++i) {
    ans = max(ans, B[i]);
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  int t = 1;
  while (t--) {
    omae_wa_mou_shindeiru();
    if (t) cout << "\n";
  }
  return 0;
}
