#include <bits/stdc++.h>
const double EPS = 1e-24;
const long long int MOD = 1000000007ll;
const double PI = 3.14159265359;
int INF = 2147483645;
long long int INFINF = 9223372036854775807;
template <class T>
T Max2(T a, T b) {
  return a < b ? b : a;
}
template <class T>
T Min2(T a, T b) {
  return a < b ? a : b;
}
template <class T>
T Max3(T a, T b, T c) {
  return Max2(Max2(a, b), c);
}
template <class T>
T Min3(T a, T b, T c) {
  return Min2(Min2(a, b), c);
}
template <class T>
T Max4(T a, T b, T c, T d) {
  return Max2(Max2(a, b), Max2(c, d));
}
template <class T>
T Min4(T a, T b, T c, T d) {
  return Min2(Min2(a, b), Max2(c, d));
}
using namespace std;
void KMPconstructlps(string &_s, int _lps[]) {
  int _len = 0;
  int _i = 1;
  _lps[0] = 0;
  while (_i < _s.size()) {
    if (_s[_i] == _s[_len]) {
      _len++;
      _lps[_i] = _len;
      _i++;
    } else {
      if (_len != 0)
        _len = _lps[_len - 1];
      else {
        _lps[_i] = 0;
        _i++;
      }
    }
  }
}
int n, k;
string s;
int lps[1000010];
int ans[1000010];
int ans1[1000010];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  cin >> s;
  n = s.size();
  KMPconstructlps(s, lps);
  for (int i = 0; i < n; i++) {
    int x = i + 1 - lps[i];
    if ((i + 1) % x == 0) {
      int y = (i + 1) / x;
      if (y % k == 0) {
        ans[i] = 1;
      }
    }
  }
  for (int i = 0; i < n;) {
    if (ans[i]) {
      ans1[i] = 1;
      int j = i + 1;
      for (; j < n; j++) {
        if (ans[j]) break;
        int x = lps[j] - lps[i];
        if ((x <= (i + 1) / k) && x >= 1)
          ans1[j] = 1;
        else
          break;
      }
      i = j;
    } else
      i++;
  }
  for (int i = 0; i < n; i++) cout << ans1[i];
  cout << "\n";
  return 0;
}
