#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
int Next[MAXN], n, k;
char s[MAXN];
int main() {
  scanf("%d%d", &n, &k);
  scanf("%s", s + 1);
  Next[1] = 0;
  int j = 0;
  for (int i = 2; i <= n; i++) {
    while (j && s[i] != s[j + 1]) j = Next[j];
    if (s[i] == s[j + 1]) j++;
    Next[i] = j;
  }
  for (int i = 1; i <= n; i++) {
    int T = i - Next[i], f = i / T;
    if (i % T == 0)
      printf("%d", f / k >= f % k);
    else
      printf("%d", f / k > f % k);
  }
  return 0;
}
