#include <bits/stdc++.h>
const int maxn = 1e6 + 5;
using namespace std;
int z[maxn], cnt[maxn];
string s;
void Z(int n) {
  int L = 0, R = 0;
  for (int i = 1; i < n; i++) {
    z[i] = max(0, 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];
  }
}
int main() {
  int n, k;
  cin >> n >> k;
  cin >> s;
  Z(n);
  for (int l = 1; l <= n / k; l++) {
    bool ok = true;
    for (int j = 1; j < k; j++) ok &= (z[j * l] >= l);
    if (!ok) continue;
    cnt[l * k]++;
    cnt[l * k + min(l, z[l * k]) + 1]--;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += cnt[i];
    cout << (ans > 0);
  }
  cout << endl;
  return 0;
}
