#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const long long mod = 1e9 + 7;
const long long inf = 1e18 + 10;
int f[N], st[N], ft[N], ps[N], t;
vector<int> adj[N];
void dfs(int v) {
  st[v] = t++;
  for (int u : adj[v]) dfs(u);
  ft[v] = t;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  string s;
  cin >> n >> k >> s;
  adj[0].push_back(1);
  for (int i = 1; i < n; i++) {
    int j = f[i - 1];
    while (j && s[i] != s[j]) j = f[j - 1];
    if (s[i] == s[j]) j++;
    f[i] = j;
    adj[j].push_back(i + 1);
  }
  dfs(0);
  for (int i = 1; i * k <= n; i++) {
    if (!(st[i * k - i] <= st[i * k] && ft[i * k] <= ft[i * k - i])) continue;
    int l = i * k, r = min(n + 1, i * k + i + 1);
    while (1 < r - l) {
      int mid = (l + r) / 2;
      if (st[mid - i * k] <= st[mid] && ft[mid] <= ft[mid - i * k])
        l = mid;
      else
        r = mid;
    }
    ps[i * k]++;
    ps[r]--;
  }
  for (int i = 1; i <= n; i++) {
    ps[i] += ps[i - 1];
    cout << (0 < ps[i]);
  }
  return 0;
}
