#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T sqr(const T& a) {
  return a * a;
}
template <typename T>
inline int sign(const T& a) {
  return a < 0 ? -1 : a > 0;
}
void task();
int main() {
  task();
  return 0;
}
vector<int> z_function(string s) {
  int n = (int)s.length();
  vector<int> z(n);
  for (int i = 1, l = 0, r = 0; i < n; ++i) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
int n, k;
string s;
int ans[int(2e6) + 10];
int add[int(2e6) + 10];
int sub[int(2e6) + 10];
void task() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  cin >> s;
  auto z = z_function(s);
  z[0] = s.length();
  (void(1));
  for (int len = 1; len <= n; ++len) {
    for (int i = 0, step = 0; i < n; i += len, ++step) {
      if (z[i] < len) break;
      if (step == k - 1) {
        (void(1));
        add[i + len - 1]++;
        sub[i + len - 1 + min(len, z[i + len])]++;
        break;
      }
    }
  }
  int cur = 0;
  for (int i = 0; i < n; ++i) {
    cur += add[i];
    ans[i] = cur > 0;
    cur -= sub[i];
  }
  for (int i = 0; i < n; ++i) cout << ans[i];
}
