#include <bits/stdc++.h>
using namespace std;
bool isprime(unsigned long long int ar) {
  if (ar == 1) return false;
  unsigned long long int i;
  for (i = 2; i * i <= ar; i++) {
    if (ar % i == 0) return false;
  }
  return true;
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, k, t = 0, cnt = 0;
  int x[26] = {0};
  cin >> n >> k;
  string s;
  cin >> s;
  for (long long int i = 0; i < n; i++) {
    if (i == 0 || s[i] == s[i - 1]) {
      t++;
    } else
      t = 1;
    if (t == k) {
      t = 0;
      x[s[i] - 'a']++;
    }
  }
  sort(x, x + 26);
  cout << x[25];
}
