#include <bits/stdc++.h>
int const MAX = 1e6 + 5;
char s[MAX];
int next[MAX];
int n, k;
void get_next() {
  int j = -1;
  next[0] = -1;
  for (int i = 1; i < n; i++) {
    while (j != -1 && s[j + 1] != s[i]) j = next[j];
    if (s[j + 1] == s[i]) j++;
    next[i] = j;
  }
}
int main() {
  scanf("%d %d %s", &n, &k, s);
  get_next();
  for (int i = 0; i < n; i++) {
    int len = i - next[i];
    int num = (i + 1) / len;
    int t = num % k;
    if (t == 0)
      printf("1");
    else {
      if (len * num != i + 1) t++;
      if ((num - (num % k)) / k >= t)
        printf("1");
      else
        printf("0");
    }
  }
  printf("\n");
}
