#include <bits/stdc++.h>
using namespace std;
char s[1000010];
int z[1000010];
void calcZ(char* s, int* z) {
  int n = strlen(s);
  int mxr = 1;
  int mxl = 1;
  for (int i = 1; i < n; i++) {
    int cur = max(0, min(z[i - mxl], mxr - i));
    while (s[cur] == s[i + cur]) {
      cur++;
      mxl = i;
      mxr = i + cur;
    }
    z[i] = cur;
  }
}
int n, k;
int sum[1000010];
int main() {
  scanf("%d %d", &n, &k);
  scanf("%s", s);
  calcZ(s, z);
  for (int first = 1; first <= n / k; first++) {
    if (z[first] >= (k - 1) * first) {
      int p = k * first;
      sum[p - 1]++;
      sum[p + min(first, z[p])]--;
    }
  }
  int o = 0;
  for (int i = 0; i < n; i++) {
    o += sum[i];
    if (o > 0)
      printf("1");
    else
      printf("0");
  }
  printf("\n");
  return 0;
}
