#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<long long> v(26, 0);
  long long i = 0, j = 0;
  while (i < n) {
    long long count = 0;
    while (j < n && s[j] == s[i]) count++, j++;
    v[s[i] - 'a'] += (count / k);
    i = j;
  }
  long long ans = *max_element((v).begin(), (v).end());
  cout << ans;
}
int32_t main() {
  std::ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  { solve(); }
}
