#include <bits/stdc++.h>
using namespace std;
int n, k, p, sum, Next[2100000], next1[2100000], ss[2100000];
char S[2100000];
int main() {
  scanf("%d%d", &n, &k);
  scanf("%s", S + 1);
  Next[1] = 0;
  for (int i = 2; i <= n; i++) {
    while (p && S[p + 1] != S[i]) p = Next[p];
    if (S[p + 1] == S[i]) p++;
    Next[i] = p;
  }
  int i;
  for (next1[p = 1] = 0, i = 2; i <= n; i++) {
    next1[i] = max(0, min(next1[i - p + 1], p + next1[p] - i));
    while (S[i + next1[i]] == S[next1[i] + 1]) next1[i]++;
    if (i + next1[i] > p + next1[p]) p = i;
  }
  for (int i = 1; i * k <= n; i++)
    if (i % (i * k - Next[i * k]) == 0) {
      int l = min(next1[i * k + 1], i);
      ss[i * k]++;
      ss[i * k + l + 1]--;
    }
  for (int i = 1; i <= n; i++) {
    sum += ss[i];
    if (sum)
      printf("1");
    else
      printf("0");
  }
}
