#include <bits/stdc++.h>
using namespace std;
inline long long add(long long a, long long b) {
  a += b;
  if (a > 1000000007) a -= 1000000007;
  return a;
}
inline long long sub(long long a, long long b) {
  a -= b;
  if (a < 0) a += 1000000007;
  return a;
}
int n, k;
char str[1000010];
long long pa[1000010], pb[1000010], ha[1000010], hb[1000010];
int d[1000010];
int ct[1000010];
char ans[1000010];
inline long long geta(int i, int len) {
  i--;
  return ha[i + len] - ha[i] * pa[len];
}
inline long long getb(int i, int len) {
  i--;
  return sub(hb[i + len], hb[i] * pb[len] % 1000000007);
}
int main() {
  pa[0] = pb[0] = 1;
  for (int i = 1; i < 1000010; i++) {
    pa[i] = pa[i - 1] * 37;
    pb[i] = pb[i - 1] * 37 % 1000000007;
  }
  scanf("%d%d%s", &n, &k, str + 1);
  for (int i = 1; i <= n; i++) {
    ha[i] = ha[i - 1] * 37 + (str[i] - 'a' + 1);
    hb[i] = hb[i - 1] * 37 + (str[i] - 'a' + 1);
    hb[i] %= 1000000007;
  }
  for (int i = 1; i * k <= n; i++) {
    long long cura = geta(1, i);
    long long curb = getb(1, i);
    d[i] = i;
    for (int j = i + 1; j + i - 1 <= n; j += i) {
      long long cur2a = geta(j, i);
      long long cur2b = getb(j, i);
      if (cura == cur2a && curb == cur2b)
        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 (geta(1, mid) == geta(d[i] + 1, mid) &&
            getb(1, mid) == getb(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);
}
