#include <bits/stdc++.h>
using namespace std;
long long add(long long a, long long b) {
  a += b;
  if (a > 1000000007) a -= 1000000007;
  return a;
}
long long sub(long long a, long long b) {
  a -= b;
  if (a < 0) a += 1000000007;
  return a;
}
struct H {
  long long a, b;
  H(long long x = 0, long long y = 0) : a(x), b(y) {}
  H operator*(H h) { return H(a * h.a, (b * h.b) % 1000000007); }
  H operator+(H h) { return H(a + h.a, add(b, h.b)); }
  H operator-(H h) { return H(a - h.a, sub(b, h.b)); }
  H operator*(long long x) { return H(a * x, (b * x) % 1000000007); }
  H operator+(long long x) { return H(a + x, add(b, x)); }
  H operator-(long long x) { return H(a - x, sub(b, x)); }
  bool operator==(H h) { return a == h.a && b == h.b; }
};
int n, k;
char str[1000010];
H p[1000010], h[1000010];
int d[1000010];
int ct[1000010];
char ans[1000010];
H get(int i, int len) {
  i--;
  return h[i + len] - h[i] * p[len];
}
int main() {
  p[0] = H(1, 1);
  for (int i = 1; i < 1000010; i++) p[i] = p[i - 1] * 37;
  scanf("%d%d%s", &n, &k, str + 1);
  for (int i = 1; i <= n; i++) {
    h[i] = h[i - 1] * 37 + (str[i] - 'a' + 1);
  }
  for (int i = 1; i * k <= n; i++) {
    H cur = get(1, i);
    d[i] = i;
    for (int j = i + 1; j + i - 1 <= n; j += i) {
      H cur2 = get(j, i);
      if (cur == cur2)
        d[i] += i;
      else
        break;
      if (d[i] > i * (k + 1)) break;
    }
    if (d[i] < i * (k + 1)) {
      int lo = 0, hi = min(i, n + 1 - d[i]), mid;
      while (hi - lo > 1) {
        mid = (lo + hi) / 2;
        if (get(1, mid) == get(d[i] + 1, mid))
          lo = mid;
        else
          hi = mid;
      }
      d[i] += lo;
    }
    int lo = i * k;
    int hi = min(lo + i, d[i]);
    if (lo > hi) continue;
    ct[lo]++;
    ct[hi + 1]--;
  }
  for (int i = 1; i <= n; i++) ct[i] += ct[i - 1];
  for (int i = 1; i <= n; i++) {
    if (ct[i])
      ans[i] = '1';
    else
      ans[i] = '0';
  }
  ans[n + 1] = 0;
  puts(ans + 1);
}
