#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void amin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
inline void amax(T &a, const T &b) {
  if (a < b) a = b;
}
vector<int> Z_Algorithm(const string &s) {
  int n = s.size();
  vector<int> z(n);
  int l = 0, r = 0;
  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--;
      }
    }
  }
  return z;
}
int N, K;
char S[1000111];
long long P[1000111];
int main() {
  scanf("%d%d%s", &N, &K, S);
  string st = S;
  vector<int> Z = Z_Algorithm(S);
  for (long long L = 1; L <= N; L++) {
    if (L * K > N) break;
    bool ok = true;
    for (int i = 1; i < K; i++) {
      if (Z[L * i] < L) {
        ok = false;
        break;
      }
    }
    if (!ok) continue;
    int lo = 0, hi = L + 1;
    while (hi - lo > 1) {
      int m = (lo + hi) / 2;
      if (L * K + m > N || Z[L * K] < m)
        hi = m;
      else
        lo = m;
    }
    P[L * K - 1]++;
    P[L * K + lo]--;
  }
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    P[i + 1] += P[i];
    printf("%d", P[i] ? 1 : 0);
  }
  putchar('\n');
  return 0;
}
