#include <bits/stdc++.h>
char s[200005];
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  getchar();
  cin >> s;
  int maxn1 = 0;
  for (int i = 0; i < 26; i++) {
    char t = 'a' + i;
    int sum1 = 0;
    int maxn = 0;
    for (int j = 0; j < n; j++) {
      if (s[j] == t && s[j + 1] == t)
        sum1++;
      else if (s[j] == t && s[j + 1] != t) {
        sum1++;
        maxn += sum1 / k;
        sum1 = 0;
      }
    }
    maxn1 = max(maxn, maxn1);
  }
  cout << maxn1 << endl;
  return 0;
}
