#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string needle;
  cin >> needle;
  vector<int> jump(n + 1);
  int j = -1;
  int i = 0;
  jump[0] = -1;
  while (i < n) {
    if (j >= 0 && needle[i] != needle[j])
      j = jump[j];
    else
      jump[++i] = ++j;
  }
  string rval(n, '0');
  for (int i = 0; i < (int)n; ++i) {
    long long int N = i + 1;
    long long int M = N - jump[i + 1];
    int ok = 0;
    long long int pom = N / M;
    long long int mult = pom / k;
    if (mult > 0 && N / (mult * M) == k) {
      ok = 1;
    }
    if (N % M == 0) {
      if (N % (M * k) == 0 || N % (M * (k + 1)) == 0) ok = 1;
    }
    rval[i] = ok + '0';
  }
  cout << rval << endl;
  return 0;
}
