#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000100;
int nt[maxn], f[maxn], n, k;
char str[maxn];
void kmp() {
  nt[0] = -1;
  int i = 0, j = -1;
  while (i < n) {
    if (j == -1 || str[i] == str[j])
      nt[++i] = ++j;
    else
      j = nt[j];
  }
  j = 0;
  memset(f, -1, sizeof(f));
  for (int i = 0; i < n; i++) {
    int l = i - nt[i];
    if (str[i] == str[nt[i]] && (i + 1) % l == 0 && ((i + 1) / l) % k == 0 &&
        (i + 1) / k / l > 0) {
      printf("1");
      f[i] = 0;
      j = (i + 1) / k;
    } else if (i && f[i - 1] != -1 && str[f[i - 1]] == str[i] && f[i - 1] < j) {
      printf("1");
      f[i] = f[i - 1] + 1;
    } else if (k == 1)
      printf("1");
    else {
      printf("0");
      j = 0;
    }
  }
  printf("\n");
}
int main() {
  scanf("%d%d", &n, &k);
  scanf("%s", str);
  kmp();
}
