#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
long long pw[maxn], hsh[maxn];
long long base = 131, mod = 1e9 + 7;
int ps[maxn];
long long get(int l, int r) {
  return ((hsh[r] - hsh[l] * pw[r - l] % mod) + mod) % mod;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  pw[0] = 1;
  for (int i = 1; i <= n; i++) {
    pw[i] = pw[i - 1] * base % mod;
  }
  for (int i = 0; i < n; i++) {
    hsh[i + 1] = hsh[i] * base % mod + (s[i] - 'a');
  }
  for (int i = 1; i <= n / k; i++) {
    int le = i * k;
    if (get(0, le - i) == get(i, le)) {
      int l = 0, r = min(i + 1, n + 1);
      while (l + 1 < r) {
        int mid = (l + r) / 2;
        if (get(0, mid) == get(le, le + mid)) {
          l = mid;
        } else {
          r = mid;
        }
      }
      ps[le]++;
      ps[le + r]--;
    }
  }
  for (int i = 1; i <= n; i++) {
    ps[i] += ps[i - 1];
    cout << (ps[i] > 0);
  }
  return 0;
}
