#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n, k, i, j, l, r, z[N];
int f[N], x, y;
char s[N];
int main() {
  scanf("%d%d", &n, &k);
  scanf("%s", &s);
  r = -1;
  for (i = 1; i < n; i++) {
    if (i <= r) z[i] = ((z[i - l]) < (r - i + 1) ? (z[i - l]) : (r - i + 1));
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) z[i]++;
    if (i + z[i] - 1 > r) r = i + z[i] - 1, l = i;
  }
  r = -1;
  for (i = 0; i < n; i++) {
    if (i <= r) f[i] = 1;
    if (i % k != 0) continue;
    x = i / k;
    if (z[x] < i - x) continue;
    y = ((z[i]) < (x) ? (z[i]) : (x));
    if (i - 1 >= 0) f[i - 1] = 1;
    if (y > 0) f[i] = 1;
    r = ((r) > (i + y - 1) ? (r) : (i + y - 1));
  }
  if (n - 1 <= r)
    f[n - 1] = 1;
  else if (n % k == 0) {
    x = n / k;
    if (z[x] >= n - x) f[n - 1] = 1;
  }
  for (i = 0; i < n; i++) printf("%d", f[i]);
  printf("\n");
  return 0;
}
