#include <bits/stdc++.h>
using namespace std;
string s;
int k;
int check(char c, int i) {
  for (int j = 0; j < k; j++) {
    if (!(i + j < s.size() && s[i + j] == c)) {
      return j;
    }
  }
  return 0;
}
signed main() {
  int n, x;
  int mas[28];
  for (int i = 0; i < 28; i++) {
    mas[i] = 0;
  }
  cin >> n >> k;
  cin >> s;
  for (int i = 0; i < n;) {
    int h = check(s[i], i);
    if (h == 0) {
      mas[s[i] - 'a']++;
      i += k;
    } else {
      i += h;
    }
  }
  int max = mas[0];
  for (int i = 1; i < 28; i++) {
    if (max < mas[i]) max = mas[i];
  }
  cout << max << endl;
  return 0;
}
