#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  int n, k;
  string s;
  scanf("%d%d", &n, &k);
  cin >> s;
  vector<int> a(30, 0);
  int cnt = 1;
  for (int i = (0); i < (n); i++) {
    if (k == 1) {
      a[s[i] - 'a']++;
    } else {
      if (s[i] == s[i + 1]) {
        cnt++;
      } else {
        cnt = 1;
      }
      if (cnt == k) {
        a[s[i] - 'a']++;
        cnt = 1;
        i += 1;
      }
    }
  }
  sort(a.begin(), a.end(), greater<int>());
  cout << a[0] << endl;
  return 0;
}
