#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, k;
  cin >> n >> k;
  cin >> s;
  int i = 0;
  int a[26];
  for (i = 0; i < 26; i++) {
    a[i] = 0;
  }
  i = 0;
  int j = 0;
  while (i < n) {
    if (s[i] == s[j]) {
      j++;
    } else {
      int x1 = s[i] - 'a';
      a[x1] += (j - i) / k;
      i = j;
    }
  }
  sort(a, a + 26);
  cout << a[25];
}
