#include <bits/stdc++.h>
using namespace std;
bool debug;
const int inf = 1e9 + 5;
const int nax = 1e6 + 5;
const int czapa = (1 << 20);
long long P[2] = {(long long)1e6 + 33, (long long)1e6 + 37},
          mod[2] = {(long long)1e9 + 7, (long long)1e9 + 33};
long long pot[2][nax], hasz[2][nax];
char t[nax];
int n, k;
int d[2 * czapa];
long long get_hasz(int pocz, int dl) {
  if (pocz == 1) return hasz[0][dl];
  long long x = hasz[0][pocz + dl - 1] - hasz[0][pocz - 1] * pot[0][dl];
  x %= mod[0];
  x += mod[0];
  x %= mod[0];
  return x;
  long long y = hasz[1][pocz + dl - 1] - hasz[1][pocz - 1] * pot[1][dl];
  y %= mod[1];
  y += mod[1];
  y %= mod[1];
}
int query(int a) {
  a += czapa;
  int res = 0;
  while (a) {
    res |= d[a];
    a /= 2;
  }
  return res;
}
void insert(int a, int b) {
  a += czapa;
  b += czapa;
  d[a] = d[b] = 1;
  while (a / 2 != b / 2) {
    if (!(a & 1)) d[a + 1] = 1;
    if (b & 1) d[b - 1] = 1;
    a /= 2;
    b /= 2;
  }
}
void obczaj(int dl) {
  int b = k;
  auto x = get_hasz(1, dl);
  while (b) {
    if (b & 1) {
      if (get_hasz((b - 1) * dl + 1, dl) != x) return;
    }
    b /= 2;
    if (get_hasz(1, b * dl) != get_hasz(b * dl + 1, b * dl)) return;
  }
  int l = k * dl;
  int ile = 0;
  int zasieg = min(dl, n - k * dl);
  int pod = 1;
  while (pod <= zasieg) pod *= 2;
  pod /= 2;
  while (pod) {
    if (ile + pod <= zasieg &&
        get_hasz(1, ile + pod) == get_hasz(k * dl + 1, ile + pod))
      ile += pod;
    pod /= 2;
  }
  insert(l, l + ile);
}
int main(int argc, char* argv[]) {
  debug = argc > 1;
  scanf("%d%d", &n, &k);
  scanf(" %s", t + 1);
  for (int g = 0; g <= (2) - 1; ++g)
    for (int i = 1; i <= n; ++i)
      hasz[g][i] = (hasz[g][i - 1] * P[g] + t[i]) % mod[g];
  for (int g = 0; g <= (2) - 1; ++g) {
    pot[g][0] = 1;
    for (int i = 1; i <= n; ++i) pot[g][i] = (pot[g][i - 1] * P[g]) % mod[g];
  }
  for (int i = 1; i <= n / k; ++i) obczaj(i);
  for (int i = 1; i <= n; ++i) printf("%d", query(i));
  puts("");
  return 0;
}
