#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int i, j, k, p, len, n;
  cin >> n >> k >> s;
  int arr[30] = {0};
  char x = 'a';
  for (i = 0; i < 26; i++) {
    x = 'a' + i;
    p = 0;
    for (j = 0; j < n; j++) {
      if (s[j] == x)
        p++;
      else
        p = 0;
      if (p == k) {
        arr[i]++;
        p = 0;
      }
    }
  }
  p = 0;
  for (i = 0; i < 26; i++) {
    p = max(p, arr[i]);
  }
  cout << p << endl;
  return 0;
}
