#include <bits/stdc++.h>
using namespace std;
string s;
int z[2000010], n, k;
int a[2000010], sum[2000010], num;
inline void Z(string t) {
  int l = 0;
  int r = 0;
  for (int i = 1; i < n; i++) {
    if (i <= r) z[i] = min(z[i - l], r - i);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) z[i]++;
    if (i + z[i] > r) {
      l = i;
      r = i + z[i];
    }
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  cin >> s;
  Z(s);
  for (int i = 1; i <= n / k; i++) {
    bool flag = false;
    for (int j = 1; j < k; j++) {
      int cnt1 = i * j;
      if (z[cnt1] < i) {
        flag = true;
        break;
      }
    }
    if (!flag) {
      int now = k * i + 1;
      int val = min(z[now - 1], i);
      a[now - 1] += 1;
      a[now + val] += -1;
    }
  }
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];
  for (int i = 1; i <= n; i++) {
    if (sum[i] > 0)
      cout << "1";
    else
      cout << "0";
  }
  cout << endl;
  return 0;
}
