#include <bits/stdc++.h>
using namespace std;
struct Grid {
  int x, y, t;
};
struct Edge {
  int to, cost;
};
struct Graph {
  vector<vector<Edge>> E;
  int V;
  const long long Inf = 1e18;
  const int MAX_V = 1010;
  vector<long long> d;
  Graph(int n) : E(n) {
    d.resize(MAX_V);
    E.resize(n);
    V = n;
  }
  void init() {
    for (int i = 0; i < MAX_V; i++) d[i] = Inf;
  }
  void add_edge(int from, int to, int cost) {
    E[from - 1].push_back({to - 1, cost});
  }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int ans[30] = {};
  int cnt = 0;
  for (int i = 1; i < n; i++) {
    if (s[i] == s[i - 1]) {
      cnt++;
      if (i == n - 1) {
        cnt++;
        ans[s[i] - 'a'] += cnt / k;
      }
    } else {
      cnt++;
      ans[s[i - 1] - 'a'] += cnt / k;
      cnt = 0;
      if (i == n - 1 && k == 1) {
        ans[s[i] - 'a']++;
      }
    }
  }
  int anss = 0;
  for (int i = 0; i < 26; i++) anss = max(anss, ans[i]);
  if (n == 1) {
    cout << 1 << endl;
  } else {
    cout << anss << endl;
  }
  return 0;
}
