#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 2e9;
const long long LINF = 2e18;
const int N = 1e6 + 20;
int f[N], n, k;
string s;
void buildKMP(string s, int F[]) {
  for (int i = 2; i <= s.size(); i++) {
    int j = F[i - 1];
    while (true) {
      if (s[j] == s[i - 1]) {
        F[i] = j + 1;
        break;
      }
      if (j == 0) {
        F[i] = 0;
        break;
      }
      j = F[j];
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k >> s;
  buildKMP(s, f);
  for (int i = 1; i <= n; i++) {
    if (k == 1) {
      cout << 1;
      continue;
    }
    int x = i - f[i];
    if (f[i] == 0)
      cout << 0;
    else {
      if (i % x == 0 && i / x - 1LL * ((i / x) % k) * (k + 1) >= 0)
        cout << 1;
      else if (i / x - (k + 1LL * ((i / x) % k) * (k + 1)) >= 0)
        cout << 1;
      else
        cout << 0;
    }
  }
  cout << endl;
}
