#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n, m, Next[N];
bool ans[N];
char s[N], t[N];
int main() {
  scanf("%d%d", &n, &m);
  scanf("%s", s + 1);
  int p = 0;
  for (int i = 2; i <= n; i++) {
    while (p && s[p + 1] != s[i]) p = Next[p];
    if (s[p + 1] == s[i]) p++;
    Next[i] = p;
  }
  for (int i = 1; i <= n; i++) {
    int tmp = i - Next[i];
    if (i % tmp == 0) {
      int res = i / tmp;
      if (res / m >= res % m) ans[i] = 1;
    } else {
      int res = i / tmp;
      if (res / m > res % m) ans[i] = 1;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d", ans[i]);
  return 0;
}
