#include <bits/stdc++.h>
using namespace std;
const unsigned long long prm = 9901;
const int maxn = 1100000;
const unsigned long long inf = 1000000007;
unsigned long long hsh[maxn], pw[maxn];
char s[maxn];
int res[maxn];
inline int leng(const int& x, const int& y, const int& k) {
  if (k == 0) return 0;
  if (s[x + 1] != s[y + 1]) return 0;
  int lef = 1, rig = k;
  while (lef < rig) {
    int len = rig - (rig - lef) / 2;
    if ((hsh[x + len] + inf - hsh[x] * pw[len] % inf) % inf ==
        (hsh[y + len] + inf - hsh[y] * pw[len] % inf) % inf)
      lef = len;
    else
      rig = len - 1;
  }
  return lef;
}
int main() {
  pw[0] = 1;
  for (int i = 1; i < maxn - 10; ++i) pw[i] = pw[i - 1] * prm % inf;
  int n, k;
  scanf("%d %d", &n, &k);
  scanf("%s", &s[1]);
  for (int i = 1; i <= n; ++i)
    hsh[i] = (hsh[i - 1] * prm + (s[i] - 'a' + 1)) % inf;
  for (int i = 1; i <= n; ++i) {
    if (i * k > n) break;
    if (k == 1) {
      res[i] += 1;
      res[i + 1] -= 1;
      continue;
    }
    if (hsh[i * k - i] !=
        (hsh[i * k] + inf - hsh[i] * pw[i * k - i] % inf) % inf)
      continue;
    res[i * k]++;
    int len = leng(0, i * k, min(i, n - i * k));
    res[i * k + len + 1]--;
  }
  for (int i = 1; i <= n; ++i) {
    res[i] += res[i - 1];
    if (res[i] > 0)
      putchar('1');
    else
      putchar('0');
  }
  puts("");
  return 0;
}
