#include <bits/stdc++.h>
using namespace std;
template <typename T>
std::ostream &operator<<(std::ostream &out, vector<T> &v) {
  for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
    out << v[i] << " ";
  out << "\n";
  return out;
}
template <typename T>
std::ostream &operator<<(std::ostream &out, vector<vector<T> > &v) {
  for (size_t i = 0; i < v.size(); ++i) {
    for (size_t j = 0; j < v[i].size(); ++j) {
      out << v[i][j] << " ";
    }
    out << "\n";
  }
  return out;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  if (n == 1) {
    cout << "1\n";
    return 0;
  }
  vector<int> subs(26);
  for (char c = 'a'; c < 'a' + 26; ++c) {
    int curr_length = 0;
    for (int i = 0; i < n; ++i) {
      if (s[i] == c) {
        ++curr_length;
      } else {
        curr_length = 0;
      }
      if (curr_length == k) {
        ++subs[c - 'a'];
        curr_length = 0;
      }
    }
  }
  int level = 0;
  for (int i = 0; i < 26; ++i) {
    level = max(level, subs[i]);
  }
  cout << level << "\n";
  return 0;
}
