#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, j;
  string s;
  cin >> n >> k >> s;
  int ans[30] = {0};
  for (int i = 0; i < n - k + 1;) {
    bool f = 1;
    for (j = i + 1; j < i + k; j++) {
      if (s[i] != s[j]) {
        f = 0;
        break;
      }
    }
    if (f) {
      ans[s[i] - 'a']++;
      i += k;
    } else
      i = j;
  }
  int mx = 0;
  for (int i = 0; i < 30; i++) mx = max(mx, ans[i]);
  cout << mx;
  return 0;
}
