#include <bits/stdc++.h>
using namespace std;
char s[400400];
long long dp[100100];
int main() {
  int n, k;
  cin >> n >> k;
  scanf("%s", s);
  for (int i = 0; i < n;) {
    int j = i;
    long long r = 0;
    for (; j < n; j++) {
      if (s[i] != s[j]) break;
      r++;
    }
    dp[s[i] - 'a'] += r / k;
    i = j;
  }
  long long res = 0;
  for (int i = 0; i < 100; i++) {
    res = max(res, dp[i]);
  }
  cout << res << endl;
  return 0;
}
