#include<iostream> #include<cstring> #include<vector> #define maxn 1000010 #define ll long long usingnamespacestd;
int n, k; char s[maxn];
int nxt[maxn]; voidinit_nxt(char *s){ int k = 0, t = 0, n = strlen(s + 1); nxt[1] = 0; for (int i = 2; i <= n; ++i) { while (k && s[k + 1] != s[i]) k = nxt[k]; if (s[k + 1] == s[i]) ++k; nxt[i] = k; } }
cin >> n >> k >> s + 1; init_nxt(s); for (int i = 1; i <= n; ++i) { int len = i - nxt[i], d = i / len; if (i % len == 0) ans[i] = d / k >= d % k; else ans[i] = d / k > d % k; cout << ans[i]; } return0; }