#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e6 + 6;
long long h[N], p[N], t[N], n, i, j, k, l, m, r, x;
char c;
int main() {
  cin >> n >> k;
  for (p[0] = i = 1; i <= n; i++) {
    scanf(" %c", &c);
    h[i] = (h[i - 1] + p[i - 1] * (c - 'a' + 1)) % mod;
    p[i] = p[i - 1] * 31 % mod;
  }
  for (i = 1; i <= n; i++) {
    if (i * k > n) break;
    for (j = i; j <= i * k; j += i)
      if ((h[i] * p[j - i] % mod + mod) % mod != (h[j] - h[j - i] + mod) % mod)
        break;
    if (j > i * k) {
      t[i * k]++;
      l = 0;
      r = min(n - i * k, i) + 1;
      for (; l + 1 < r;) {
        m = l + r >> 1;
        if ((h[m] * p[i * k] % mod + mod) % mod !=
            (h[i * k + m] - h[i * k] + mod) % mod)
          r = m;
        else
          l = m;
      }
      t[i * k + r]--;
    }
  }
  for (i = 1; i <= n; i++) {
    x += t[i];
    cout << (x > 0);
  }
  return 0;
}
