#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int count[n + 1][26];
  int i, j;
  for (i = 0; i <= n; i++) {
    for (j = 0; j < 26; j++) count[i][j] = 0;
  }
  for (i = 1; i <= n; i++) {
    count[i][s[i - 1] - 'a'] += 1;
    for (j = 0; j < 26; j++) {
      count[i][j] += count[i - 1][j];
    }
  }
  int total[26];
  for (i = 0; i < 26; i++) total[i] = 0;
  for (i = 1; i <= n - k + 1;) {
    int check = 0;
    for (j = 0; j < 26; j++) {
      if (count[i + k - 1][j] - count[i - 1][j] == k) {
        check = 1;
        total[j]++;
        break;
      }
    }
    if (check == 1)
      i = i + k;
    else
      i++;
  }
  int x = 0;
  for (i = 0; i < 26; i++) {
    if (total[i] > x) x = total[i];
  }
  cout << x << endl;
  return 0;
}
