#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000005;
int z[MAXN];
int sweep[MAXN];
string s;
int n, k;
void zalgo() {
  int l = 0, r = 0;
  for (int i = 1; i < n; i++) {
    z[i] = min(z[i - l], max(0, r - i));
    while (s[z[i]] == s[i + z[i]]) z[i] += 1;
    if (i + z[i] > r) l = i, r = i + z[i];
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  cin >> s;
  zalgo();
  z[0] = s.length();
  for (int g = 1; g <= s.length(); g++) {
    int flag = 1;
    for (int y = 0, cnt = 0; y < s.length() && cnt < k; y += g, cnt++) {
      if (z[y] < g) {
        flag = 0;
        break;
      }
    }
    if (!flag) continue;
    if (1LL * k * g > s.length()) continue;
    sweep[min((int)s.length(), k * g - 1)]++;
    sweep[min((int)s.length(), k * g + min(g, z[k * g]))]--;
  }
  int cn = 0;
  for (int g = 0; g < s.length(); g++) {
    cn += sweep[g];
    if (cn > 0)
      cout << '1';
    else
      cout << '0';
  }
  return 0;
}
