#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
const int MAXN = 1e6 + 10;
const int MOD = 1e9 + 7, P = 31;
int ans[MAXN];
long long h[MAXN];
char s[MAXN];
long long powp[MAXN];
int nxt[MAXN], prv[MAXN];
long long get_hash(int l, int r) {
  return ((h[r] - h[l - 1] * powp[r - l + 1]) % MOD + MOD) % MOD;
}
void remove(int i) {
  nxt[prv[i]] = nxt[i];
  prv[nxt[i]] = prv[i];
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  scanf("%s", s + 1);
  powp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    h[i] = (P * h[i - 1] + s[i]) % MOD;
    nxt[i] = i + 1;
    prv[i] = i - 1;
    powp[i] = (P * powp[i - 1]) % MOD;
  }
  int at = 1;
  for (int i = k; i <= n; i += k) {
    while (at <= i) at = nxt[at];
    int len = i / k;
    bool ok = 1;
    long long firstHash = h[len];
    for (int j = 1; j < k; j++) {
      if (get_hash(1 + j * len, 1 + (j + 1) * len - 1) != firstHash) {
        ok = 0;
        break;
      }
    }
    if (!ok) continue;
    ans[i] = 1;
    remove(i);
    int cur = at;
    while (cur < 1 + (k + 1) * len && cur <= n) {
      int sublen = cur - i;
      if (h[sublen] == get_hash(i + 1, cur)) {
        ans[cur] = 1;
        if (cur == at) at = nxt[at];
        remove(cur);
      } else
        break;
      cur = nxt[cur];
    }
  }
  for (int i = 1; i <= n; i++) printf("%d", ans[i]);
  printf("\n");
  return 0;
}
