#include <bits/stdc++.h>
using namespace std;
map<long long int, long long int> m;
vector<long long int> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  string a;
  cin >> a;
  long long int max = 0;
  string ss = "abcdefghijklmnopqrstuvwxyz";
  for (long long int i = 0; i < 26; i++) {
    long long int ans = 0;
    long long int count = 0;
    for (long long int j = 0; j < n; j++) {
      if (k == 1) {
        if (a[j] == ss[i]) ans++;
      } else {
        if (a[j] == a[j + 1] && a[j] == ss[i])
          count++;
        else
          count = 0;
        if (count == k - 1) {
          ans++;
          count = 0;
          j++;
        }
      }
    }
    if (ans > max) max = ans;
  }
  cout << max;
  return 0;
}
