#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
char s[N];
long long powx[N], powy[N];
long long hashx[N], hashy[N];
int a[N];
string ans;
bool check(int p, int q, int d) {
  long long hashp = hashx[p + d] - hashx[p];
  if (hashp < 0) hashp += 1000000007ll;
  hashp = hashp * powx[q - p] % 1000000007ll;
  long long hashq = hashx[q + d] - hashx[q];
  if (hashq < 0) hashq += 1000000007ll;
  if (hashp != hashq) return false;
  hashp = hashy[p + d] - hashy[p];
  if (hashp < 0) hashp += 1000000007ll;
  hashp = hashp * powy[q - p] % 1000000007ll;
  hashq = hashy[q + d] - hashy[q];
  if (hashq < 0) hashq += 1000000007ll;
  if (hashp != hashq) return false;
  return true;
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  scanf("%s", s);
  powx[0] = 1;
  for (int i = 0; i < n; i++) powx[i + 1] = powx[i] * 25625462 % 1000000007ll;
  powy[0] = 1;
  for (int i = 0; i < n; i++) powy[i + 1] = powy[i] * 46835134 % 1000000007ll;
  for (int i = 0; i < n; i++)
    hashx[i + 1] =
        (hashx[i] + (long long)(s[i] - 'a') * powx[i]) % 1000000007ll;
  for (int i = 0; i < n; i++)
    hashy[i + 1] =
        (hashy[i] + (long long)(s[i] - 'a') * powy[i]) % 1000000007ll;
  for (int i = 0; i < n / k + 1; i++) {
    int lb = 0, ub = n + 1;
    while (ub - lb > 1) {
      int mid = (lb + ub) >> 1;
      if (i + mid <= n && check(0, i, mid))
        lb = mid;
      else
        ub = mid;
    }
    int l = k * i;
    int r = min(l + i, i + lb);
    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';
  printf("%s\n", ans.c_str());
  return 0;
}
