#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int x = 25625462;
const int y = 46835134;
const int m = 1000010;
int n;
char s[m];
long long powx[m], powy[m];
long long hashx[m], hashy[m];
int a[m];
string ans;
bool check(int p, int q, int d) {
  long long hashp = hashx[p + d] - hashx[p];
  if (hashp < 0) hashp += mod;
  hashp = hashp * powx[q - p] % mod;
  long long hashq = hashx[q + d] - hashx[q];
  if (hashq < 0) hashq += mod;
  if (hashp != hashq) return 0;
  hashp = hashy[p + d] - hashy[p];
  if (hashp < 0) hashp += mod;
  hashp = hashp * powy[q - p] % mod;
  hashq = hashy[q + d] - hashy[q];
  if (hashq < 0) hashq += mod;
  if (hashp != hashq) return 0;
  return 1;
}
int main() {
  int k;
  cin >> n >> k;
  scanf("%s", s);
  powx[0] = 1;
  for (int i = 0; i < n; i++) powx[i + 1] = powx[i] * x % mod;
  powy[0] = 1;
  for (int i = 0; i < n; i++) powy[i + 1] = powy[i] * y % mod;
  for (int i = 0; i < n; i++) hashx[i + 1] = (hashx[i] + s[i] * powx[i]) % mod;
  for (int i = 0; i < n; i++) hashy[i + 1] = (hashy[i] + s[i] * powy[i]) % mod;
  for (int i = 0; i <= n / k; i++) {
    int l = 0, r = n + 1;
    while (r - l > 1) {
      int m = l + r >> 1;
      if (i + m <= n && check(0, i, m))
        l = m;
      else
        r = m;
    }
    int L = k * i;
    int R = min(L + i, i + l);
    if (L <= R) {
      a[L]++;
      a[R + 1]--;
    }
  }
  for (int i = 0; i < n; i++) a[i + 1] += a[i];
  for (int i = 0; i < n; i++) ans += (a[i + 1] > 0 ? '1' : '0');
  cout << ans;
}
