#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const long long mod = 1e9 + 7;
int nex[1000010];
void getnex(string s) {
  int i = 0;
  nex[0] = -1;
  int j = -1;
  int len = s.size();
  while (i < len) {
    if (j == -1 || s[i] == s[j])
      nex[++i] = ++j;
    else
      j = nex[j];
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  int i = 0;
  string s;
  cin >> s;
  getnex(s);
  for (i = 1; i <= n; i++) {
    long long t = i - nex[i];
    if (t == 0) {
      if (k == 1)
        cout << 1;
      else
        cout << 0;
      continue;
    }
    long long l = 1;
    long long r = 1000000;
    while (l < r) {
      long long mid = (l + r + 1) >> 1;
      if (i / (mid * t) >= k)
        l = mid;
      else
        r = mid - 1;
    }
    if ((i == (l * t) * (k + 1)) ||
        (i / (l * t) == k && i - k * l * t <= l * t))
      cout << 1;
    else
      cout << 0;
  }
}
