#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  int ans = 0;
  for (long long(i) = (0); (i) < (26); (i)++) {
    char c = 'a' + i;
    int cont = 0, cur = 0;
    for (long long(i) = (0); (i) < (s.size()); (i)++) {
      if (c == s[i]) {
        cur++;
        if (cur == k) {
          cur = 0;
          cont++;
        }
      } else {
        cur = 0;
      }
    }
    ans = max(ans, cont);
  }
  cout << ans << endl;
  return 0;
}
