#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i;
  cin >> n >> k;
  char s[n + 1];
  int a[123] = {0};
  int l = 1;
  for (i = 1; i < n + 1; i++) {
    cin >> s[i];
    if (s[i] == s[i - 1])
      l++;
    else
      l = 1;
    if (l == k) {
      l = 1;
      a[s[i]]++;
      s[i] = '0';
    }
  }
  int t = 0;
  for (i = 97; i <= 122; i++) {
    if (a[i] > t) t = a[i];
  }
  cout << t;
  return 0;
}
