#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
char STR[MAXN];
int G[30];
int main() {
  int N, K;
  scanf("%d %d", &N, &K);
  scanf("%s", STR);
  int len = strlen(STR);
  int st = 0;
  bool flag;
  while (st + K - 1 < len) {
    flag = true;
    for (int i = st + 1; i <= st + K - 1; i++) {
      if (STR[i] != STR[i - 1]) {
        flag = false;
        st = i;
        break;
      }
    }
    if (flag) {
      G[STR[st] - 'a']++;
      st = st + K;
    }
  }
  int ans = 0;
  for (int i = 0; i < 26; i++) {
    ans = max(G[i], ans);
  }
  printf("%d\n", ans);
  return 0;
}
