#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  long long ans = 0;
  for (char a = 'a'; a <= 'z'; ++a) {
    long long tans = 0, len = 0;
    for (char c : s) {
      if (c == a)
        len++;
      else
        tans += len / k, len = 0;
    }
    tans += len / k;
    ans = max(tans, ans);
  }
  cout << ans;
}
