#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
#pragma GCC optimize("fast-math")
using namespace std;
const int INF = 1e9;
const long long INFll = 2e18;
const int BASE1 = 179;
const int BASE2 = 653;
const long long MOD = 1e9 + 7;
const int MAXN = 1e5 + 10;
const long double PI = 3.1415926535;
const long double EPS = 1e-10;
vector<int> gener_z(string& s) {
  vector<int> zf(((int)(s).size()) + 1);
  zf[0] = 0;
  int l = 0, r = 0;
  for (int i = (1); i < (((int)(s).size())); i++) {
    if (i < r) zf[i] = min(zf[i - l], r - i);
    while (i + zf[i] < ((int)(s).size()) && s[zf[i]] == s[i + zf[i]]) zf[i]++;
    if (i + zf[i] > r) l = i, r = i + zf[i];
  }
  return zf;
}
void solve() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  if (k == 1) {
    for (int i = 0; i < (n); i++) cout << 1;
    cout << "\n";
    return;
  }
  vector<int> z = gener_z(s);
  vector<int> res(n);
  int r = -1;
  for (int i = 0; i < (n); i++) {
    if (i <= r) res[i] = 1;
    int len = i + 1;
    if (len % k != 0) continue;
    int p = len / k;
    if (z[p] >= len - p) {
      res[i] = 1;
      if (i + 1 < n) r = max(r, min(i + z[i + 1], i + p));
    }
  }
  for (int i = 0; i < (n); i++) cout << res[i];
  cout << "\n";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(15);
  int t = 1;
  while (t--) solve();
  return 0;
}
