#include <bits/stdc++.h>
using namespace std;
int n, k;
int aux[26];
string str;
int main() {
  cin >> n >> k;
  int maxi = -1;
  cin >> str;
  int i = 0;
  if (n == k && k == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (k > n) {
    cout << 0 << endl;
    return 0;
  }
  while (i < n) {
    int flag = 0;
    if (i + k <= n) {
      flag = 1;
      for (int j = i; j < i + k && flag; j++) {
        if (str[j] != str[i]) {
          i = j;
          flag = 0;
        }
      }
    } else
      break;
    if (flag) {
      aux[str[i] - 97] += 1;
      i = i + k;
    }
  }
  for (int i = 0; i < 26; i++) {
    if (aux[i] > maxi) maxi = aux[i];
  }
  cout << maxi << endl;
  return 0;
}
