#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int n, k;
string s;
int z[1000000 + 10];
void calc() {
  for (int i = 2; i <= n; ++i) {
    if (s[i] != s[i - 1]) break;
    z[2]++;
  }
  int l_bound, r_bound;
  l_bound = 2;
  r_bound = 2 + z[2] - 1;
  for (int i = 3; i <= n; ++i) {
    if (i <= r_bound) {
      z[i] = z[i - l_bound + 1];
      z[i] = min(z[i], r_bound - i + 1);
      if (z[i] + i - 1 == r_bound) {
        int ite = z[i] + 1;
        for (int j = r_bound + 1; j <= n; ++j) {
          if (s[j] != s[ite++]) break;
          z[i]++;
        }
        l_bound = i;
        r_bound = i + z[i] - 1;
      }
    } else {
      int ite = 1;
      for (int j = i; j <= n; ++j) {
        if (s[j] != s[ite++]) break;
        z[i]++;
      }
      l_bound = i;
      r_bound = z[i] + i - 1;
    }
  }
}
int start[1000000 + 10], end[1000000 + 10];
int main() {
  cin >> n >> k;
  cin >> s;
  s = '@' + s;
  calc();
  z[1] = n;
  for (int i = 1; i <= n; ++i) {
    if (i * k <= n) {
      int cnt = 1;
      for (int j = 1; j <= n && cnt <= k; j += i, cnt++) {
        if (z[j] < i) break;
        if (cnt == k) {
          start[j + i - 1]++;
          start[min(n + 1, j + i + min(z[j + i], i))]--;
        }
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    start[i] += start[i - 1];
    if (start[i] > 0)
      cout << "1";
    else
      cout << "0";
  }
  return 0;
}
