#include <bits/stdc++.h>
using namespace std;
char s[200005], c;
int a[200005];
int ans[26];
int main() {
  int n, k;
  int maxn = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i < n; i++) {
    if (s[i] == s[i - 1])
      a[i] = a[i - 1] + 1;
    else
      a[i] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (a[i] != 0 && a[i] % k == 0) ans[(int)s[i] - 'a']++;
  }
  for (int i = 0; i <= 25; i++) maxn = max(maxn, ans[i]);
  printf("%d", maxn);
  return 0;
}
