#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e6 + 5;
int n, k;
char s[maxN];
int pi[maxN];
int main() {
  scanf("%d %d\n", &n, &k);
  gets(s);
  for (int i = 1; i <= n - 1; ++i) {
    int j = pi[i - 1];
    while (j && s[i] != s[j]) j = pi[j - 1];
    if (s[i] == s[j]) ++j;
    pi[i] = j;
  }
  for (int i = 0; i <= n - 1; ++i) {
    int r = (i + 1) / (i - pi[i] + 1);
    putchar(r / k - r % k > 0 ||
                    ((i + 1) % (i - pi[i] + 1) == 0 && r / k - r % k == 0)
                ? '1'
                : '0');
  }
  return 0;
}
