#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, nxt[1000005];
char s[1000005];
int main() {
  scanf("%d%d", &n, &m);
  scanf("%s", s);
  i = 1;
  int val = 0;
  while (i < n) {
    if (s[i] == s[val])
      nxt[i++] = ++val;
    else {
      if (val == 0)
        nxt[i++] = 0;
      else
        val = nxt[val - 1];
    }
  }
  for (i = 0; i < n; i++) {
    int siz = i + 1 - nxt[i];
    if ((i + 1) % siz == 0) {
      int val = (i + 1) / siz;
      if (val / m - val % m >= 0)
        printf("1");
      else
        printf("0");
    } else {
      int val = (i + 1) / siz;
      if (val / m - val % m > 0)
        printf("1");
      else
        printf("0");
    }
  }
  printf("\n");
}
