#include <bits/stdc++.h>
using namespace std;
const long long MOD = (1 << 29) - 7;
int len, k;
string s;
long long Hash[1000005];
long long Pow[1000005];
int a[1000005];
bool Cycle_k(int x) {
  for (int i = 2; i <= k; i++)
    if (Hash[x * i - 1] != (Hash[x * (i - 1) - 1] * Pow[x] + Hash[x - 1]) % MOD)
      return 0;
  return 1;
}
bool is_Prefix(int from, int to) {
  if ((Hash[to] - Hash[from] * Pow[to - from] + MOD * MOD) % MOD ==
      Hash[to - from - 1])
    return 1;
  return 0;
}
int main() {
  fill(a, a + 1000005, -1);
  cin >> len >> k;
  cin >> s;
  Hash[0] = s[0] - 'a' + 1;
  for (int i = 1; i < len; i++)
    Hash[i] = (Hash[i - 1] * 29 + s[i] - 'a' + 1) % MOD;
  Pow[0] = 1;
  for (int i = 1; i <= len; i++) Pow[i] = Pow[i - 1] * 29 % MOD;
  for (int i = 1; i <= len / k + 1; i++) {
    if (!Cycle_k(i)) continue;
    int lo = 0, hi = i + 1, mid;
    while (lo < hi) {
      mid = (lo + hi + 1) / 2;
      if (k * i + mid <= len and is_Prefix(k * i - 1, k * i - 1 + mid))
        lo = mid;
      else
        hi = mid - 1;
    }
    hi = min(hi, i);
    a[k * i - 1] = max(a[k * i - 1], k * i - 1 + hi);
  }
  int mx = -1;
  for (int i = 0; i < len; i++) {
    if (a[i] > mx) mx = a[i];
    if (i <= mx)
      cout << '1';
    else
      cout << '0';
  }
  cout << '\n';
  return 0;
}
