#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<long long> val;
  for (long long j = (0); j < ('z' - 'a' + 1); j++) {
    val.push_back(0);
  }
  int count = 0;
  int prev = 0;
  for (long long j = (0); j < (n); j++) {
    if (j == 0) {
      count = 1;
      prev = s[j];
    } else {
      if (s[j] == prev) {
        count++;
      } else {
        if (count >= k) {
          val[prev - 'a'] = val[prev - 'a'] + count / k;
        }
        count = 1;
        prev = s[j];
      }
    }
  }
  if (count >= k) {
    val[prev - 'a'] = val[prev - 'a'] + count / k;
  }
  long long result = 0;
  for (long long j = (0); j < ('z' - 'a' + 1); j++) {
    if (val[j] > result) {
      result = val[j];
    }
  }
  cout << result;
  return 0;
}
