#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 30;
vector<int> adj[maxn];
string s;
int st[maxn], fi[maxn];
int f[maxn];
int x, n, k;
int par[maxn], ps[maxn];
int now;
void dfs(int v) {
  st[v] = now++;
  for (int u : adj[v]) dfs(u);
  fi[v] = now;
}
bool chck(int a, int b) { return st[b] <= st[a] && fi[b] >= fi[a]; }
int main() {
  cin >> n >> k >> s;
  int cur = 0;
  for (int i = 1; i < s.size(); i++) {
    while (cur and s[cur] != s[i]) {
      cur = f[cur];
    }
    cur += s[cur] == s[i];
    f[i + 1] = cur;
  }
  for (int i = 1; i <= n; i++) {
    adj[f[i]].push_back(i);
  }
  dfs(0);
  for (int i = 1; i * k <= (int)s.size(); i++) {
    if (!chck(i * k, i * (k - 1))) continue;
    int l = i * k, r = min(n, i * k + i) + 1;
    while (r - l > 1) {
      int mid = (l + r) / 2;
      if (chck(mid, mid - i * k))
        l = mid;
      else
        r = mid;
    }
    ps[i * k]++, ps[l + 1]--;
  }
  for (int i = 1; i <= n; i++) {
    ps[i] += ps[i - 1];
    cout << (ps[i] > 0);
  }
  cout << '\n';
}
