#include <bits/stdc++.h>
using namespace std;
const int Mod = 1000000007;
const int P1 = 100007;
const int P2 = 1000007;
long long hs1[1000010], hs2[1000010], pw1[1000010], pw2[1000010];
char s[1000010];
int a[1000010];
bool same(int L1, int R1, int L2, int R2) {
  if (L1 > R1) {
    return true;
  }
  long long hs11, hs12, hs21, hs22;
  int len = R1 - L1 + 1;
  hs11 = hs1[R1];
  hs12 = hs2[R1];
  if (L1) {
    hs11 -= (hs1[L1 - 1] * pw1[len]) % Mod;
    if (hs11 < 0) {
      hs11 += Mod;
    }
    hs12 -= (hs2[L1 - 1] * pw2[len]) % Mod;
    if (hs12 < 0) {
      hs12 += Mod;
    }
  }
  hs21 = hs1[R2];
  hs22 = hs2[R2];
  if (L2) {
    hs21 -= (hs1[L2 - 1] * pw1[len]) % Mod;
    if (hs21 < 0) {
      hs21 += Mod;
    }
    hs22 -= (hs2[L2 - 1] * pw2[len]) % Mod;
    if (hs22 < 0) {
      hs22 += Mod;
    }
  }
  return hs11 == hs21 && hs12 == hs22;
}
int main() {
  int n, K;
  scanf("%d%d", &n, &K);
  scanf("%s", s);
  hs1[0] = s[0];
  hs2[0] = s[0];
  for (int i = 1; i < n; i++) {
    hs1[i] = (hs1[i - 1] * P1 + s[i]) % Mod;
    hs2[i] = (hs2[i - 1] * P2 + s[i]) % Mod;
  }
  pw1[0] = pw2[0] = 1;
  for (int i = 1; i <= n; i++) {
    pw1[i] = pw1[i - 1] * P1 % Mod;
    pw2[i] = pw2[i - 1] * P2 % Mod;
  }
  for (int l = 1; l * K <= n; l++) {
    int L = 0, R = l - 1, tL, tR;
    bool sol = true;
    for (int j = 0; j < K; j++) {
      tL = j * l, tR = j * l + l - 1;
      if (!same(L, R, tL, tR)) {
        sol = false;
      }
    }
    if (sol) {
      int ansL = tR, ansR = min(n - 1, tR + l);
      while (ansL + 1 < ansR) {
        int mid = (ansL + ansR) / 2;
        if (same(L, L + mid - (tR + 1), tR + 1, mid)) {
          ansL = mid;
        } else {
          ansR = mid;
        }
      }
      int res;
      if (same(L, L + ansR - (tR + 1), tR + 1, ansR)) {
        res = ansR;
      } else {
        res = ansL;
      }
      a[tR]++;
      a[res + 1]--;
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += a[i];
    if (sum) {
      putchar('1');
    } else {
      putchar('0');
    }
  }
  return 0;
}
