#include <bits/stdc++.h>
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  std::cerr.tie(0);
  int64_t x = 0, n, k;
  std::cin >> n >> k;
  std::string st;
  std::cin >> st;
  char s = st[0];
  int curr = 1;
  std::vector<int64_t> diff(26, 0);
  for (int i = 1; i < n; ++i) {
    if (s == st[i]) {
      ++curr;
    } else {
      diff[s - 'a'] += curr / k;
      curr = 1;
      s = st[i];
    }
  }
  diff[s - 'a'] += curr / k;
  for (auto& it : diff) {
    x = std::max(x, it);
  }
  std::cout << x;
}
