#include <bits/stdc++.h>
using namespace std;
const int Maxm = 1e6 + 50;
int nxt[Maxm], len1, Q;
char s[Maxm];
inline void pre() {
  memset(nxt, 0, sizeof(nxt));
  for (int j = 0, i = 2; i <= len1; i++) {
    while (j > 0 && s[j + 1] != s[i]) j = nxt[j];
    if (s[j + 1] == s[i]) j++;
    nxt[i] = j;
  }
}
int main() {
  scanf("%d%d", &len1, &Q);
  scanf("%s", s + 1);
  pre();
  for (int i = 1; i <= len1; i++) {
    int S = i / (i - nxt[i]);
    int R = S % Q;
    if (i % (i - nxt[i])) {
      if (S / Q - R > 0)
        putchar('1');
      else
        putchar('0');
    } else {
      if (S / Q - R >= 0)
        putchar('1');
      else
        putchar('0');
    }
  }
}
