#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> occ(255);
  string s;
  cin >> s;
  long long streak = 0;
  char curr = s[0];
  for (long long i = 0; i < n; i++) {
    if (s[i] == curr) {
      streak++;
      if (streak == k) {
        occ[curr]++;
        streak = 0;
      }
    } else {
      streak = 1;
      curr = s[i];
    }
  }
  long long mx = 0;
  for (long long i = 0; i < 255; i++) {
    mx = max(occ[i], mx);
  }
  cout << mx << endl;
}
