#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
class mint {
 public:
  int first;
  mint(long long second = 0) {
    second %= MOD;
    if (second < 0) second += MOD;
    first = second;
  }
};
mint operator+(mint a, mint b) {
  a.first += b.first;
  if (a.first >= MOD) a.first -= MOD;
  return a;
}
mint operator-(mint a, mint b) {
  a.first -= b.first;
  if (a.first < 0) a.first += MOD;
  return a;
}
mint operator*(mint a, mint b) {
  return mint((long long)a.first * (long long)b.first);
}
bool operator!=(mint a, mint b) { return a.first != b.first; }
bool operator==(mint a, mint b) { return a.first == b.first; }
int n, k;
char in[1000005];
const mint P = 101;
mint H[1000005];
mint Hpot[1000005];
void InitHash() {
  Hpot[0] = 1;
  for (int i = (1), _for = (1000005); i < _for; ++i) Hpot[i] = P * Hpot[i - 1];
  H[0] = 0;
  for (int i = (0), _for = (n); i < _for; ++i) H[i + 1] = H[i] * P + in[i];
}
mint GetHash(int lo, int hi) { return H[hi + 1] - H[lo] * Hpot[hi - lo + 1]; }
bool check(int len) {
  for (int i = (0), _for = (k); i < _for; ++i)
    if (GetHash(0, len - 1) != GetHash(i * len, i * len + len - 1))
      return false;
  return true;
}
int lcp(int a, int b, int len) {
  int lo = 0, hi = min(n - b, len), mid = (lo + hi + 1) / 2;
  while (lo != hi) {
    if (GetHash(a, a + mid - 1) == GetHash(b, b + mid - 1))
      lo = mid;
    else
      hi = mid - 1;
    mid = (lo + hi + 1) / 2;
  }
  return mid;
}
int out[1000005];
int main() {
  scanf("%d%d%s", &n, &k, in);
  InitHash();
  for (int first = (1), _for = (n / k + 1); first < _for; ++first) {
    if (!check(first)) continue;
    int ID = first * k;
    int T = lcp(0, ID, first);
    ++out[ID - 1];
    --out[ID + T];
  }
  int tmp = 0;
  for (int i = (0), _for = (n); i < _for; ++i) {
    tmp += out[i];
    if (tmp)
      printf("1");
    else
      printf("0");
  }
  printf("\n");
  return 0;
}
