#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> st;
  int ans = 0;
  for (int i = 0; i < 26; i++) {
    char cont = 'a' + i;
    int d = 0;
    int j = 0;
    while (j < n) {
      int l = 0;
      while (s[j] == cont) {
        l++;
        j++;
      }
      st.push_back(l);
      j++;
    }
    for (int x : st) {
      if (x >= k) d += (x / k);
    }
    ans = max(d, ans);
    st.clear();
  }
  cout << ans << endl;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
