#include <bits/stdc++.h>
using namespace std;
int f[1000005];
char s[1000005];
int fin[1000005];
int n, k;
void getfail() {
  int len = strlen(s);
  f[0] = 0;
  f[1] = 0;
  if (k == 1) fin[0] = 1;
  for (int i = 1; i < len; i++) {
    int j = f[i];
    while (j && s[j] != s[i]) j = f[j];
    f[i + 1] = s[i] == s[j] ? j + 1 : 0;
    if ((i + 1) % (i + 1 - f[i + 1])) {
      int r = (i + 1) / (i + 1 - f[i + 1]);
      if (r / k - r % k > 0) fin[i] = 1;
    } else {
      int r = (i + 1) / (i + 1 - f[i + 1]);
      if (r / k - r % k >= 0) fin[i] = 1;
    }
  }
}
int main() {
  scanf("%d%d", &n, &k);
  scanf("%s", s);
  getfail();
  for (int i = 0; i < n; i++) printf("%d", fin[i]);
}
