#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int a[30];
  memset(a, 0, sizeof(a));
  int length = 1;
  for (int i = 1; i < s.length(); ++i) {
    if (s[i] == s[i - 1])
      ++length;
    else {
      a[s[i - 1] - 'a' + 1] += length / k;
      length = 1;
    }
  }
  a[s[s.length() - 1] - 'a' + 1] += length / k;
  int maxx = 0;
  for (int i = 0; i <= 26; ++i) {
    maxx = max(maxx, a[i]);
  }
  cout << maxx;
}
