#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long modexp(long long n, long long e) {
  if (e == 0) return 1;
  long long half = modexp(n, e / 2);
  long long ans = (half * half) % mod;
  if (e % 2 == 0)
    return ans;
  else
    return (ans * n) % mod;
}
long long inv29 = modexp(29, mod - 2);
long long hashsub(vector<long long>& hashes, long long st, long long end,
                  vector<long long>& invs) {
  if (st == 0) return hashes[end];
  long long sub = (hashes[end] - hashes[st - 1]);
  sub *= invs[st];
  sub %= mod;
  if (sub < 0) {
    sub += mod;
    sub %= mod;
  }
  return sub;
}
int main() {
  int N, k;
  scanf("%d %d\n", &N, &k);
  vector<char> str(N);
  for (int i = 0; i < N; i++) scanf(" %c", &str[i]);
  if (k > 1) {
    vector<long long> hashes(N, 0);
    vector<long long> invs(N, 0);
    hashes[0] = str[0];
    invs[0] = 1;
    long long pow = 29;
    for (int i = 1; i < N; i++) {
      hashes[i] = hashes[i - 1] + pow * str[i];
      if (hashes[i] > mod) hashes[i] %= mod;
      pow *= 29;
      if (pow > mod) pow %= mod;
      invs[i] = invs[i - 1] * inv29;
      if (invs[i] > mod) invs[i] %= mod;
    }
    vector<int> ints(N + 1, 0);
    for (int a = 1; a * k <= N; a++) {
      long long block = hashsub(hashes, 0, a - 1, invs);
      bool good = true;
      for (int i = 1; i < k; i++) {
        long long nblock = hashsub(hashes, i * a, (i + 1) * a - 1, invs);
        if (nblock != block) good = false;
      }
      if (good) {
        if (k * a < N && str[k * a] == str[0]) {
          int low = 0;
          int high = min(a, N - a * k);
          while (high - low > 1) {
            int mid = (low + high) / 2;
            if (hashsub(hashes, k * a, k * a + mid, invs) ==
                hashsub(hashes, 0, mid, invs)) {
              low = mid;
            } else {
              high = mid;
            }
          }
          ints[a * k - 1]++;
          ints[a * k + high]--;
        } else {
          ints[a * k - 1]++;
          ints[a * k]--;
        }
      }
    }
    int cur = 0;
    for (int i = 0; i < N; i++) {
      cur += ints[i];
      if (cur > 0)
        printf("1");
      else
        printf("0");
    }
    printf("\n");
  } else {
    for (int i = 0; i < N; i++) printf("1");
    printf("\n");
  }
  return 0;
}
