#include <bits/stdc++.h>
using namespace std;
char S[200005];
int main() {
  int n, k;
  int x;
  int tmp;
  while (~scanf("%d%d", &n, &k)) {
    scanf("%s", S);
    x = 0;
    for (int i = 'a'; i <= 'z'; i++) {
      tmp = 0;
      for (int j = 0; j < n; j++) {
        bool flag = true;
        if (S[j] == i) {
          if (j + k - 1 >= n)
            flag = false;
          else {
            for (int q = j; q < j + k; q++) {
              if (S[q] != i) {
                flag = false;
                break;
              }
            }
          }
          if (flag) tmp++;
          j = j + k - 1;
        }
      }
      x = max(x, tmp);
    }
    printf("%d\n", x);
  }
  return 0;
}
