#include <bits/stdc++.h>
double eps = 1e-9;
using namespace std;
int z[1000001];
int ans[1000002];
void zfunc(string &s) {
  int L = 0, R = 0;
  int n = s.size();
  for (int i = 1; i < n; i++) {
    if (i > R) {
      L = R = i;
      while (R < n && s[R - L] == s[R]) R++;
      z[i] = R - L;
      R--;
    } else {
      int k = i - L;
      if (z[k] < R - i + 1)
        z[i] = z[k];
      else {
        L = i;
        while (R < n && s[R - L] == s[R]) R++;
        z[i] = R - L;
        R--;
      }
    }
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  zfunc(s);
  z[0] = n;
  for (int i = 1; i <= n / k; i++) {
    int flag = 1;
    int pos = 0;
    for (int j = 0; j < k; j++) {
      if (z[pos] < i) {
        flag = 0;
        break;
      }
      pos += i;
    }
    if (flag == 0) {
      continue;
    }
    ans[pos - 1] += 1;
    ans[min(z[pos], i) + pos] -= 1;
  }
  if (ans[0]) {
    cout << 1;
  } else {
    cout << 0;
  }
  for (int i = 1; i < n; i++) {
    ans[i] += ans[i - 1];
    if (ans[i]) {
      cout << 1;
    } else {
      cout << 0;
    }
  }
  return 0;
}
