#include <bits/stdc++.h>
using namespace std;
int n, k;
const int MAXN = 1000000;
char s[MAXN + 1];
bool b[MAXN];
int c[MAXN];
int *z_function(char *s, int n) {
  int *z = new int[n];
  z[0] = 0;
  for (int l = 0, r = 0, i = 1; i < n; i++) {
    z[i] = (i <= r) ? min(r - i + 1, z[i - l]) : 0;
    while (i + z[i] < n && s[i + z[i]] == s[z[i]]) z[i]++;
    if (i + z[i] - 1 > r) {
      l = i;
      r = i + z[i] - 1;
    }
  }
  return z;
}
int main() {
  cin >> n >> k;
  cin >> s;
  int *z = z_function(s, n);
  for (int ab = n / k; ab >= 1; ab--) {
    bool f = true;
    for (int i = ab; i < k * ab; i += ab)
      if (z[i] < ab) f = false;
    if (f)
      c[k * ab - 1] = max(
          c[k * ab - 1],
          min(n - 1, min((k + 1) * ab - 1,
                         (k * ab < n) ? k * ab + z[k * ab] - 1 : k * ab - 1)) -
              (k * ab - 1) + 1);
  }
  for (int i = 0, h = c[0]; i < n; i++) {
    if (c[i] > h) h = c[i];
    printf("%d", (h ? 1 : 0));
    if (h) h--;
  }
  printf("\n");
  return 0;
}
