#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int f[N], st[N], en[N], ps[N], tim;
vector<int> adj[N];
void dfs(int v, int p) {
  st[v] = tim++;
  for (auto u : adj[v]) {
    if (u == p) continue;
    dfs(u, v);
  }
  en[v] = tim;
}
bool is_child(int v, int u) {
  if (st[v] <= st[u] && en[u] <= en[v]) return true;
  return false;
}
bool isEqual(int len, int k) {
  if (len == k) return true;
  if (f[len] < k) return false;
  if (is_child(k, len)) return true;
  return false;
}
bool isRegular(int len, int k) {
  if (len == k) return true;
  return isEqual(len, len - k);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int curr = 0;
  adj[0].push_back(1);
  adj[1].push_back(0);
  for (int i = 1; i < n; i++) {
    while (curr > 0 && s[curr] != s[i]) curr = f[curr];
    if (s[curr] == s[i]) curr++;
    f[i + 1] = curr;
    adj[i + 1].push_back(curr);
    adj[curr].push_back(i + 1);
  }
  dfs(0, -1);
  for (int len = k; len <= n; len += k) {
    int sz = len / k;
    if (!isRegular(len, sz)) continue;
    int lo = len, hi = min(len + sz + 1, n + 1);
    while (hi - lo > 1) {
      int mid = (lo + hi) / 2;
      if (isEqual(mid, mid - len))
        lo = mid;
      else
        hi = mid;
    }
    ps[len]++;
    ps[hi]--;
  }
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += ps[i];
    if (sum)
      cout << 1;
    else
      cout << 0;
  }
  cout << '\n';
}
