#include <bits/stdc++.h>
using namespace std;
long long hashx[1000003], powx[1000003], a[1000003], hashy[1000003],
    powy[1000003];
const int x = 1233, mod = 132412, y = 3253;
bool check(int p, int q, int d) {
  long long hashp = hashx[p + d] - hashx[p];
  if (hashp < 0) hashp += mod;
  hashp = hashp * powx[q - p] % mod;
  long long hashq = hashx[q + d] - hashx[q];
  if (hashq < 0) hashq += mod;
  if (hashp != hashq) return 0;
  hashp = hashy[p + d] - hashy[p];
  if (hashp < 0) hashp += mod;
  hashp = hashp * powy[q - p] % mod;
  hashq = hashy[q + d] - hashy[q];
  if (hashq < 0) hashq += mod;
  if (hashp != hashq) return 0;
  return 1;
}
int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  powx[0] = 1;
  powy[0] = 1;
  for (int i = 0; i < n; i++) powx[i + 1] = (powx[i] * x) % mod;
  for (int i = 0; i < n; i++) powy[i + 1] = (powy[i] * y) % mod;
  for (int i = 0; i < n; i++)
    hashy[i + 1] = (hashy[i] + (s[i] - 'a') * powy[i]) % mod;
  for (int i = 0; i < n; i++)
    hashx[i + 1] = (hashx[i] + (s[i] - 'a') * powx[i]) % mod;
  for (int i = 0; i <= n / k; i++) {
    int l = 0, r = n + 1;
    while (r > l + 1) {
      int mid = (r + l) / 2;
      if (i + mid <= n && check(0, i, mid))
        l = mid;
      else
        r = mid;
    }
    int x = k * i, y = min(x + i, i + l);
    if (x <= y) {
      a[x]++;
      a[y + 1]--;
    }
  }
  for (int i = 0; i < n; i++) a[i + 1] += a[i];
  for (int i = 1; i <= n; i++) cout << (a[i] > 0) ? '1' : '0';
}
