#include <bits/stdc++.h>
using namespace std;
bool u[1000009];
bool f[1000009];
bool u1[1000009];
int z[1000009];
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  z[0] = 0;
  int l = 0, r = 0;
  for (int i = 1; i < n; ++i) {
    if (i <= r) {
      z[i] = min(z[i - l], (r - i + 1));
    }
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) {
      l = i;
      r = i + z[i] - 1;
    }
  }
  z[0] = n;
  for (int i = 0; i < n; ++i)
    if ((i + 1) % k == 0) {
      bool f = true;
      int d = (i + 1) / k;
      for (int j = 0; j <= i; j += d) {
        if (z[j] < d) f = false;
      }
      u[i] = f;
    }
  vector<pair<int, int> > v;
  for (int i = 0; i < n; ++i)
    if (u[i]) {
      f[i] = true;
      int d = (i + 1) / k;
      if (z[i + 1] > 0 && d >= 2) {
        int a = i + 1;
        int b = i + 1 + min(z[i + 1], d - 1);
        v.push_back(make_pair(a, 1));
        v.push_back(make_pair(b, -1));
      }
    }
  sort(v.begin(), v.end());
  int curr = 0;
  for (int i = 0; i + 1 < (int)v.size(); ++i) {
    if (v[i].second == 1)
      ++curr;
    else
      --curr;
    if (v[i].first != v[i + 1].first && curr) {
      for (int j = v[i].first; j < v[i + 1].first; ++j) f[j] = true;
    }
  }
  ++k;
  for (int i = 0; i < n; ++i) {
    if ((i + 1) % k == 0) {
      bool f = true;
      int d = (i + 1) / k;
      for (int j = 0; j <= i; j += d) {
        if (z[j] < d) f = false;
      }
      u[i] = f;
    }
  }
  for (int i = 0; i < n; ++i) f[i] = (f[i] || u[i]);
  for (int i = 0; i < n; ++i) cout << (int)f[i];
  cout << endl;
}
