#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) {
  if (a > b) {
    return true;
  } else {
    return false;
  }
}
int main() {
  int n, k, le[26], cnt = 1;
  for (int i = 0; i < 26; i++) {
    le[i] = 0;
  }
  char c, ch;
  cin >> n >> k;
  getchar();
  cin >> ch;
  if (n == k & n == 1) {
    cout << 1;
    return 0;
  }
  for (int i = 0; i < n - 1; i++) {
    cin >> c;
    if (c == ch) {
      cnt++;
    }
    if (c != ch || i == n - 2) {
      le[ch - 'a'] += cnt / k;
      cnt = 1;
      ch = c;
    }
  }
  sort(le, le + 26, cmp);
  cout << le[0];
}
