#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string A;
  cin >> A;
  vector<int> p(n + 1, 0);
  int ind = -1;
  p[0] = 0;
  string ans(n, '0');
  for (int i = 1; i < n; ++i) {
    while (ind != -1 && A[ind + 1] != A[i]) {
      ind = p[ind] - 1;
    }
    if (A[i] == A[ind + 1]) ++ind;
    p[i] = ind + 1;
  }
  for (int cut = k; cut < n; cut += (k + 1)) {
    int per = cut + 1 - p[cut];
    if ((cut + 1) % per) continue;
    if ((cut + 1) / (k + 1) % per) continue;
    ans[cut] = '1';
  }
  int lim = 0;
  for (int cut = k - 1; cut < n; cut += k) {
    int per = cut + 1 - p[cut];
    if ((cut + 1) % per) continue;
    if ((cut + 1) / k % per) continue;
    ans[cut] = '1';
    for (int i = max(cut + 1, lim);
         i < n && i < cut + (cut + 1) / k && A[i] == A[i - (cut + 1)]; ++i) {
      ans[i] = '1';
      lim = i + 1;
    }
  }
  cout << ans << "\n";
}
