#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, k;
char a[N];
int l[N], dp[N][27];
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k >> s;
  for (int i = 1; i <= n; i++) a[i] = s[i - 1];
  for (int i = 1; i <= n; i++) {
    if (a[i] == a[i - 1])
      l[i] = l[i - 1] + 1;
    else
      l[i] = 1;
    for (int j = 0; j <= 25; j++) dp[i][j] = dp[i - 1][j];
    if (l[i] >= k)
      dp[i][a[i] - 'a'] = max(dp[i][a[i] - 'a'], dp[i - k][a[i] - 'a'] + 1);
  }
  int ans = 0;
  for (int i = 0; i < 26; i++) {
    ans = max(ans, dp[n][i]);
  }
  return cout << ans, 0;
}
