#include <bits/stdc++.h>
using namespace std;
int n, k, p[5000010];
char s[5000010];
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0', c = getchar();
  return x * f;
}
void kmp() {
  int j = 0;
  for (int i = 1; i < n; i++) {
    while (j && s[i + 1] != s[j + 1]) j = p[j];
    if (s[i + 1] == s[j + 1]) j++;
    p[i + 1] = j;
  }
}
int main() {
  n = read(), k = read();
  scanf("%s", s + 1);
  kmp();
  if (k != 1)
    printf("0");
  else
    printf("1");
  for (int i = 2; i <= n; i++) {
    int len = i - p[i], num = i / len;
    if (i % len)
      printf("%d", (num / k - num % k > 0));
    else
      printf("%d", (num / k - num % k >= 0));
  }
}
