#include <bits/stdc++.h>
using namespace std;
char s[200010];
int a[200010];
int ans[50];
int n, k, x;
void init() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> s[i];
  for (int i = 1; i <= n; i++) a[i] = (int)s[i] - 'a' + 1;
  a[++n] = 30;
  for (int i = 1; i <= 26; i++) {
    int l;
    bool flag = 0;
    for (int j = 1; j <= n; j++) {
      if (flag == 0 & a[j] == i) {
        l = j;
        flag = 1;
      }
      if (flag && a[j] != i) {
        ans[i] += (j - l) / k;
        flag = 0;
      }
    }
  }
}
int main() {
  init();
  for (int i = 1; i <= 26; i++) x = max(ans[i], x);
  cout << x;
  cin.get();
  cin.get();
  return 0;
}
