#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
int n, k, Next[1200000];
char c[1200000];
int main() {
  scanf("%d%d", &n, &k);
  scanf("%s", c + 1);
  Next[0] = -1;
  for (int i = 1; i <= n; ++i) {
    int p = Next[i - 1];
    for (; p != -1 && c[i] != c[p + 1]; p = Next[p])
      ;
    Next[i] = p + 1;
  }
  for (int i = 1; i <= n; ++i) {
    int v = i / (i - Next[i]);
    int x = v / k;
    int flag = 0;
    if (x > 0 && v / x == k) flag = 1;
    if (i % (i - Next[i]) == 0) {
      v--;
      x = v / k;
      if (x > 0 && v / x == k) flag = 1;
    }
    printf("%d", flag);
  }
}
