#include <bits/stdc++.h>
using namespace std;
const int inf = (1 << 30) - 1;
const int mod = 1000000007;
const int N = (int)2e6;
int n, k, z[N], ans[N];
char s[N];
int main() {
  scanf("%d%d\n", &n, &k);
  scanf("%s", s);
  for (int i = 1, l = 0, r = 0; i < n; ++i) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  for (int len = 1; len * k <= n; len++) {
    bool ok = true;
    for (int i = 1; i < k; i++) {
      if (z[i * len] < len) {
        ok = false;
        break;
      }
    }
    if (ok) {
      int pos = k * len;
      ans[pos - 1]++;
      ans[pos + min(len, z[pos])]--;
    }
  }
  int s = 0;
  for (int i = 0; i < n; i++) {
    s += ans[i];
    printf("%d", (s > 0));
  }
  puts("");
  return 0;
}
