#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 1e6 + 5;
int N, K;
int c[MAXN], z[MAXN];
char s[MAXN];
int main() {
  N = read();
  K = read();
  scanf("%s", s + 1);
  int Mx = 0, mid = 0;
  z[1] = N;
  for (int i = 2; i <= N; i++) {
    if (i < Mx) z[i] = min(z[i - mid + 1], Mx - i + 1);
    while (s[z[i] + i] == s[z[i] + 1]) z[i]++;
    if (i + z[i] - 1 > Mx) Mx = i + z[i] - 1, mid = i;
  }
  for (int i = 1; i <= N / K; i++) {
    bool flg = true;
    for (int j = 0; j < K; j++)
      if (z[j * i + 1] < i) {
        flg = false;
        break;
      }
    if (!flg) continue;
    int p = min(z[i * K + 1], i);
    c[i * K]++;
    c[i * K + p + 1]--;
  }
  for (int i = 1; i <= N; i++) {
    c[i] += c[i - 1];
    if (c[i])
      printf("1");
    else
      printf("0");
  }
  puts("");
  return 0;
}
