#include <bits/stdc++.h>
using namespace std;
const int R = 300005;
const int inf = 2000000001;
const int mod = 998244353;
map<char, int> m;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  string second;
  cin >> second;
  if (k == 1) {
    for (int i = 0; i < n; i++) {
      m[second[i]]++;
    }
    int ma = 0;
    for (int i = 0; i < n; i++) {
      if (m[second[i]] > ma) ma = m[second[i]];
    }
    cout << ma;
    return 0;
  }
  char last = second[0];
  int l = 1;
  for (int i = 1; i < n; i++) {
    if (second[i] == second[i - 1] && l > 0) {
      l++;
      if (l == k) {
        l = 0;
        m[second[i]]++;
      }
    } else {
      l = 1;
      last = second[i];
    }
  }
  int ma = 0;
  for (int i = 0; i < n; i++) {
    if (m[second[i]] > ma) ma = m[second[i]];
  }
  cout << ma;
}
