#include <bits/stdc++.h>
using namespace std;
const long double gr = (1 + sqrt(5)) / 2;
long long n, k, c, res[107], mres;
string s;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k >> s;
  c = 1;
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      if (s[i] == s[i - 1]) {
        c++;
        if (c == k) {
          c = 0;
          res[s[i] - 'a' + 1]++;
        }
      } else
        c = 1;
    }
    if (c == k) {
      c = 0;
      res[s[i] - 'a' + 1]++;
    }
  }
  for (int i = 1; i <= 26; i++) mres = max(mres, res[i]);
  cout << mres << endl;
}
