#include <bits/stdc++.h>
using namespace std;
long long int Pow(long long int a, long long int b, long long int md,
                  long long int ans = 1) {
  for (; b; b >>= 1, a = a * a % md)
    if (b & 1) ans = ans * a % md;
  return ans % md;
}
const long long int MAXN = 1e6 + 10;
const long long int INF = 8e18;
const long long int MOD = 1e9 + 7;
long long int timer, ptr, n, k, L[MAXN], ps[MAXN], R[MAXN], first[MAXN];
char s[MAXN];
vector<long long int> adj[MAXN];
void DFS(long long int v) {
  L[v] = timer++;
  for (long long int u : adj[v]) {
    DFS(u);
  }
  R[v] = timer;
}
long long int check(long long int l, long long int r) {
  return L[r - l + 1] <= L[r] && R[r] <= R[r - l + 1];
}
int main() {
  scanf("%lld%lld%s", &n, &k, s);
  for (long long int i = 1; i < n; i++) {
    while (ptr && s[ptr] != s[i]) ptr = first[ptr];
    if (s[i] == s[ptr]) ptr++;
    first[i + 1] = ptr;
  }
  for (long long int i = 1; i <= n; i++) {
    adj[first[i]].push_back(i);
  }
  DFS(0);
  for (long long int i = 1; i <= n; i++) {
    if (i * k > n) break;
    long long int nxt = i * k;
    if (check(i + 1, nxt) == 0) continue;
    long long int l = nxt, r = min(n + 1, nxt + i + 1);
    while (r - l > 1) {
      long long int mid = (l + r) >> 1;
      if (check(nxt + 1, mid))
        l = mid;
      else
        r = mid;
    }
    ps[nxt]++, ps[l + 1]--;
  }
  partial_sum(ps, ps + MAXN, ps);
  for (long long int i = 1; i <= n; i++) {
    if (ps[i] > 0)
      printf("1");
    else
      printf("0");
  }
  return 0;
}
