#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int arr[200];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n, k;
  string s;
  cin >> n >> k >> s;
  int ans = -1;
  if (k == 1) {
    for (int i = 0; i < n; ++i) arr[s[i]]++;
    for (int i = 'a'; i <= 'z'; ++i) ans = max(arr[i], ans);
  } else {
    for (int j = 'a'; j <= 'z'; ++j) {
      int sum = 0;
      int tmp = 0;
      for (int i = 0; i < n; ++i) {
        if (s[i] == j) {
          if (tmp > 0 && s[i - 1] == j) {
            tmp++;
            if (tmp == k) {
              sum++;
              tmp = 0;
            }
          } else {
            tmp++;
          }
        } else
          tmp = 0;
      }
      ans = max(ans, sum);
    }
  }
  cout << ans;
  return 0;
}
