#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, j;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> a(26, 0);
  for (long long i = 0; i < n; i = j) {
    bool flag = 1;
    j = i + 1;
    while (j < n && j < i + k) {
      if (s[j] != s[j - 1]) {
        flag = 0;
        break;
      }
      j++;
    }
    if (flag && (n - i) >= k) {
      a[s[i] - 'a']++;
    }
  }
  long long m = *max_element(a.begin(), a.end());
  cout << m << endl;
}
