#include <bits/stdc++.h>
using namespace std;
int n, k, ans;
string s;
long long o0o0o0[1000005], Vo_oV[1000005];
int ind[1000005];
inline long long get_hash(int x, int len) {
  return (Vo_oV[x + len - 1] - Vo_oV[x - 1] * o0o0o0[len] % 998244353 +
          998244353) %
         998244353;
}
inline bool ok(int len) {
  for (int i = 1; i < k; i++)
    if (Vo_oV[len - 1] != get_hash(i * len, len)) return 0;
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  cin >> s;
  o0o0o0[0] = 1;
  for (int i = 1; i < n; i++) o0o0o0[i] = o0o0o0[i - 1] * 29 % 998244353;
  Vo_oV[0] = s[0] - '`';
  for (int i = 1; i < n; i++)
    Vo_oV[i] = (Vo_oV[i - 1] * 29 + s[i] - '`') % 998244353;
  for (int i = 1; i <= n / k; i++) {
    if (!ok(i)) continue;
    int l = 0, r = i;
    while (l <= r) {
      int mid = (l + r) / 2;
      if (!mid) break;
      if (i * k + mid > n || get_hash(i * k, mid) != Vo_oV[mid - 1])
        r = mid - 1;
      else
        l = mid + 1;
    }
    ind[i * k - 1]++;
    if (i * k + l + 1 <= n && get_hash(i * k, l + 1) == Vo_oV[l]) l++;
    if (i * k + l > n || get_hash(i * k, l) != Vo_oV[l - 1]) l--;
    ind[i * k + min(l, i)]--;
  }
  for (int i = 0; i < n; i++) {
    ans += ind[i];
    if (ans > 0)
      cout << 1;
    else
      cout << 0;
  }
  cout << '\n';
  return 0;
}
