#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t = 1;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    string str;
    cin >> str;
    long long count[26][n];
    memset(count, 0, sizeof(count));
    for (long long i = 0; i < 26; i++) {
      if (str[0] == 'a' + i) count[i][0] = 1;
      for (long long j = 1; j < n; j++) {
        if (str[j] == 'a' + i) {
          count[i][j] = count[i][j - 1] + 1;
          if (count[i][j] == k + 1) count[i][j] = 1;
        } else
          count[i][j] = 0;
      }
    }
    long long ma = 0, temp = 0;
    for (long long i = 0; i < 26; i++) {
      temp = 0;
      for (long long j = 0; j < n; j++) {
        if (count[i][j] == k) temp++;
      }
      if (temp > ma) ma = temp;
    }
    cout << ma << endl;
  }
}
