#include <bits/stdc++.h>
const double E = exp(1);
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
using namespace std;
char ch[maxn];
int a[maxn];
bool cmp(int a, int b) { return a > b; }
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  cin >> ch;
  int res = 1;
  for (int i = 0; i < n; i++) {
    if (k == 1)
      a[ch[i] - 'a']++;
    else {
      if (ch[i] == ch[i + 1])
        res++;
      else
        res = 1;
      if (res == k) {
        a[ch[i] - 'a']++;
        res = 1;
        i += 1;
      }
    }
  }
  sort(a, a + 26, cmp);
  cout << a[0] << endl;
  return 0;
}
