#include <bits/stdc++.h>
using namespace std;
vector<int> Zalgo(string s) {
  int L = -1, R = -1;
  vector<int> z(s.size() + 1);
  for (int i = 1; i < s.size(); i++) {
    if (i > R) {
      L = R = i;
      while (R < s.size() && s[R] == s[R - L]) R++;
      z[i] = R - L;
      R--;
    } else {
      if (z[i - L] < R - i + 1)
        z[i] = z[i - L];
      else {
        L = i;
        while (R < s.size() && s[R - L] == s[R]) R++;
        z[i] = R - L;
        R--;
      }
    }
  }
  z[0] = s.size();
  return z;
}
int sum[1000005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  string x;
  cin >> x;
  vector<int> ret = Zalgo(x);
  for (int len = 1; len * k <= n; len++) {
    bool yay = 1;
    for (int i = len, j = 1; j < k && yay; j++, i += len)
      if (ret[i] < len) yay = 0;
    if (!yay) continue;
    sum[len * k - 1]++;
    sum[len * k + min(len, ret[len * k])]--;
  }
  int out = 0;
  for (auto i = 0; i < (long long)(n); i++) {
    out += sum[i];
    if (out)
      cout << 1;
    else
      cout << 0;
  }
  return 0;
}
