#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
int n, k;
char str[maxn];
int f[maxn];
int ans[maxn], A[maxn], B[maxn];
void get_f(char* str) {
  int _str = strlen(str);
  f[0] = 0;
  f[1] = 0;
  for (int i = 1; i <= _str - 1; i++) {
    int j = f[i];
    while (j && str[i] != str[j]) j = f[j];
    f[i + 1] = (str[i] == str[j] ? j + 1 : 0);
  }
}
int main() {
  scanf("%d%d", &n, &k);
  scanf("%s", str);
  get_f(str);
  memset(ans, 0, sizeof(ans));
  for (int i = 0; i <= n - 1; i++) {
    if (f[i + 1] && (i + 1) % (i + 1 - f[i + 1]) == 0) {
      int all = (i + 1) / (i + 1 - f[i + 1]);
      if (all % k == 0) {
        ans[i] = 1;
        A[i] = 0;
        B[i] = (i + 1) / k;
        continue;
      }
    }
    if (i && ans[i - 1] && str[i] == str[i - A[i - 1] - B[i - 1]] && B[i - 1]) {
      ans[i] = 1;
      A[i] = A[i - 1] + 1;
      B[i] = B[i - 1] - 1;
      continue;
    }
    if (f[i + 1] && (i + 1) % (i + 1 - f[i + 1]) == 0) {
      int all = (i + 1) / (i + 1 - f[i + 1]);
      if (all % (k + 1) == 0) {
        ans[i] = 1;
        A[i] = (i + 1) / (k + 1);
        B[i] = 0;
      }
    }
  }
  if (k == 1)
    for (int i = 0; i <= n - 1; i++) ans[i] = 1;
  for (int i = 0; i <= n - 1; i++) printf("%d", ans[i]);
  printf("\n");
  return 0;
}
