#include <bits/stdc++.h>
using namespace std;
inline void solve() {
  long long int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  map<char, long long int> m, m2;
  for (long long int i = 0; i < n; i++) {
    m2[s[i]]++;
  }
  long long int cnt = 1;
  if (k == 1) {
    long long int mxx = -1;
    for (auto it : m2) {
      mxx = max(mxx, it.second);
    }
    cout << mxx << '\n';
    return;
  }
  for (long long int i = 0; i < n - 1; i++) {
    if (s[i] == s[i + 1]) {
      cnt++;
      if (cnt == k) {
        m[s[i]]++;
        cnt = 0;
      }
    } else {
      cnt = 1;
      if (cnt == k) {
        m[s[i]]++;
      }
    }
  }
  if (cnt == k && k == 1) {
    m[s[n - 1]]++;
  }
  long long int x = 0;
  for (auto it : m) {
    x = max(x, it.second);
  }
  cout << x << '\n';
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tests = 1;
  while (tests--) {
    solve();
  }
}
