#include <bits/stdc++.h>
using namespace std;
int n, k;
string s;
int mark[1000002];
const long long int p1 = 31, M1 = 1000000007;
long long int hs[1000002];
long long int pw1[1000002], inv1[1000002];
long long int mod_pow(long long int base, long long int mod) {
  long long int ret = 1, exp = mod - 2;
  while (exp) {
    if (exp % 2) ret = (ret * base) % mod;
    exp = exp >> 1;
    base = (base * base) % mod;
  }
  return ret;
}
void buildhash() {
  long long int m1 = 1, m2 = 1;
  for (long long int i = 1; i <= n; ++i) {
    if (i == 1)
      hs[i] = s[1] - 'a' + 1;
    else {
      long long int pres = ((s[i] - 'a' + 1) * m1) % M1;
      hs[i] = (hs[i - 1] + pres) % 1000000007;
    }
    m1 = (m1 * p1) % M1;
  }
  pw1[0] = 1;
  for (long long int i = 1; i <= n; ++i) pw1[i] = (p1 * pw1[i - 1]) % M1;
  for (long long int i = 0; i <= n; ++i) {
    if (i == 0)
      inv1[i] = 1;
    else if (i == 1)
      inv1[i] = mod_pow(pw1[i], M1);
    else
      inv1[i] = (inv1[1] * inv1[i - 1]) % M1;
  }
}
long long int get_hash(long long int l, long long int r) {
  if (l == 1) return hs[r];
  long long int ret = hs[r];
  ret = ((ret - hs[l - 1]) % M1 + M1) % M1;
  ret = (ret * inv1[l - 1]) % M1;
  return ret;
}
int z[1000002];
void Z(string s) {
  int l = 1, r = 1;
  int n = s.size() - 1;
  for (long long int i = 2; i <= n; ++i) {
    if (r < i) {
      l = r = i;
      long long int st = 1;
      while (r <= n && s[r] == s[st]) {
        r++;
        st++;
      }
      z[i] = r - i;
      r--;
    } else {
      long long int k = i - l;
      k++;
      if (z[k] < r - i + 1) {
        z[i] = z[k];
      } else {
        l = i;
        long long int st = r - i + 2;
        r++;
        while (r <= n && s[r] == s[st]) {
          r++;
          st++;
        }
        z[i] = r - i;
        r--;
      }
    }
  }
}
int cto[1000005];
int ans[1000005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k >> s;
  s = "$" + s;
  buildhash();
  if (k == 1) {
    for (long long int i = 1; i <= n; ++i) cout << "1";
    cout << '\n';
    return 0;
  }
  for (long long int i = 1; i <= n; ++i) {
    if (i % k == 0) {
      long long int len = (i / k);
      long long int per = get_hash(1, len);
      long long int temph = per;
      for (long long int j = 1; j <= k - 1; ++j) {
        per = (per * pw1[len]) % M1;
        per = (per + temph) % M1;
      }
      if (per == get_hash(1, i)) {
        mark[i] = 1;
        ans[i - 1] = 1;
      }
    }
    if (i % (k + 1) == 0) {
      k++;
      long long int len = (i / k);
      long long int per = get_hash(1, len);
      long long int temph = per;
      for (long long int j = 1; j <= k - 1; ++j) {
        per = (per * pw1[len]) % M1;
        per = (per + temph) % M1;
      }
      if (per == get_hash(1, i)) ans[i - 1] = 1;
      k--;
    }
  }
  Z(s);
  for (long long int i = 1; i <= n - 1; ++i) {
    if (!mark[i]) continue;
    long long int len = i / k;
    if (len == 1) continue;
    long long int mi = min((int)len - 1, z[i + 1]);
    if (!mi) continue;
    cto[i + 1]++;
    cto[i + mi + 1]--;
  }
  long long int tot = 0;
  for (long long int i = 1; i <= n; ++i) {
    tot += cto[i];
    if (tot > 0) ans[i - 1] = 1;
  }
  for (long long int i = 0; i <= n - 1; ++i) cout << ans[i];
  cout << '\n';
}
