#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  map<char, int> m;
  string temp = "";
  for (int i = 0; i < s.length(); i++) {
    if (temp.length() == k) {
      m[temp[0]]++;
      temp = "";
    }
    if (!temp.empty() && temp[0] != s[i]) temp = "";
    temp += s[i];
  }
  if (temp.length() == k) {
    m[temp[0]]++;
    temp = "";
  }
  int result = 0;
  for (auto it = m.begin(); it != m.end(); it++)
    if (it->second > result) result = it->second;
  cout << result << endl;
}
