#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
const double pi = 3.1415926535;
const int mod = 1e9 + 7;
int main() {
  int n, k;
  while (cin >> n >> k) {
    string s;
    cin >> s;
    long long ans = 0;
    for (int x = 0; x < 26; x++) {
      char ch = (char)(x + 'a');
      long long ret = 0;
      long long cnt = 0;
      for (int i = 0; i < n; i++) {
        if (s[i] != ch) {
          ret += cnt / k;
          cnt = 0;
        } else
          cnt++;
      }
      ret += cnt / k;
      ans = max(ans, ret);
    }
    cout << ans << endl;
  }
}
