#include <bits/stdc++.h>
using namespace std;
inline void update(int &a, int b) {
  if (a < b) a = b;
}
int n, k, z[1100001], valid[1100001];
char s[1100001];
int main() {
  scanf("%d%d%s", &n, &k, s + 1);
  z[1] = n;
  int l = 1, r = 1;
  for (int i = 2; i <= n; i++)
    if (z[i - l + 1] < r - i + 1)
      z[i] = z[i - l + 1];
    else {
      if (i <= r) z[i] = r - i + 1;
      while (z[i] + i <= n && s[z[i] + i] == s[z[i] + 1]) z[i]++;
      l = i, r = i + z[i] - 1;
    }
  for (int i = n / k + 1; i > 1; i--) {
    bool f = 1;
    for (int j = 1; j < k; j++)
      if (z[(i - 1) * j + 1] < i - 1) {
        f = 0;
        break;
      }
    if (f)
      update(valid[(i - 1) * k], 1),
          update(valid[(i - 1) * k + 1], min(z[(i - 1) * k + 1], i - 1));
  }
  for (int i = 2; i <= n; i++) update(valid[i], valid[i - 1] - 1);
  for (int i = 1; i <= n; i++) printf("%d", !!valid[i]);
  puts("");
}
