#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> a[26];
  for (int i = 0; i < s.size();) {
    char r = s[i];
    long long sum = 0;
    while (r == s[i] && i < s.size()) {
      i++;
      sum++;
    }
    a[r - 97].push_back(sum);
  }
  long long maxx = 0;
  for (int i = 0; i < 26; i++) {
    long long sum = 0;
    for (auto x : a[i]) {
      sum += x / k;
    }
    maxx = max(maxx, sum);
  }
  cout << maxx << "\n";
  return 0;
}
