#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> a[30];
  for (int i = 0; i < n; i++) {
    int t = 0, j = i;
    while (s[j] == s[i]) {
      j++;
    }
    a[s[i] - 97].push_back(j - i);
    i = j - 1;
  }
  int ans = 0;
  for (int i = 0; i < 30; i++) {
    int su = 0;
    for (int j = 0; j < a[i].size(); j++) {
      su += a[i][j] / k;
    }
    ans = max(ans, su);
  }
  cout << ans;
}
