#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m;
int f[1000010], K[1000010], huan[1000010], qian[1000010];
char p[1000010];
int main() {
  scanf("%d%d%s", &n, &m, p + 1);
  m++;
  for (j = 0, i = 2; i <= n; i++) {
    for (; j && p[j + 1] != p[i]; j = f[j])
      ;
    if (p[j + 1] == p[i]) j++;
    f[i] = j;
  }
  int A;
  for (A = 1; A <= n; A++) {
    int x = f[A];
    huan[A] = A - x;
    qian[A] = x % huan[A];
    K[A] = A / huan[A];
    {
      int ci = K[A] + (qian[A] > 0);
      int ge = ci / m + (ci % m > 0);
      int c = ci / ge + (ci % ge > 0);
      if (c == m || qian[A] == 0 && K[A] % (m - 1) == 0)
        printf("1");
      else
        printf("0");
    }
  }
  printf("\n");
  return 0;
}
