#include <bits/stdc++.h>
using namespace std;
void fun(void) { cout << "HAHA"; }
void yeh(void) { cout << "LOL"; }
int32_t main() {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  if (k == 1) {
    long long c2[26] = {0};
    for (long long i = 0; i < n; ++i) {
      c2[s[i] - 'a']++;
    }
    long long mx = INT_MIN;
    for (long long i = 0; i < 26; ++i) {
      mx = max(c2[i], mx);
    }
    cout << mx;
    return 0;
  }
  long long freq[26] = {0};
  char ch;
  long long cnt = 1;
  for (long long i = 0; i < n - 1; ++i) {
    ch = s[i];
    if (s[i + 1] == s[i]) {
      cnt++;
    } else {
      cnt = 1;
    }
    if (cnt == k) {
      cnt = 1;
      i++;
      freq[ch - 'a']++;
    }
  }
  long long mx = -1;
  for (long long i = 0; i < 26; ++i) {
    mx = max(mx, freq[i]);
  }
  cout << mx;
}
