#include <bits/stdc++.h>
using namespace std;
template <class T>
istream& operator>>(istream& in, vector<T>& v) {
  for (size_t i = 0; i < v.size(); ++i) {
    in >> v[i];
  }
  return in;
}
template <class T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
  }
  return out;
}
template <class T>
vector<T> mkvec(int n) {
  return vector<T>(n);
}
template <class T>
vector<vector<T> > mkvec(int n, int m) {
  return vector<vector<T> >(n, vector<T>(m));
}
template <class T>
vector<vector<vector<T> > > mkvec(int n, int m, int k) {
  return vector<vector<vector<T> > >(n, vector<vector<T> >(m, vector<T>(k)));
}
template <class T>
class vpr {
 public:
  vpr(const vector<T>& v, const string& sep) : vec1(v), sep1(sep) {}
  const vector<T>& vec1;
  const string& sep1;
};
template <class T>
ostream& operator<<(ostream& out, const vpr<T>& pr) {
  for (int i = 0; i < pr.vec1.size(); ++i) {
    if (i > 0) {
      out << pr.sep1;
    }
    out << pr.vec1[i];
  }
  return out;
}
int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  string ans = "";
  ans.resize(n, '0');
  int per = 1;
  int p[1100000];
  p[0] = 0;
  for (int i = 0; i < (n); ++i) {
    if (i == 0) {
      if (k == 1) ans[0] = '1';
      continue;
    }
    int j = p[i - 1] - 1;
    while (true) {
      if (s[j + 1] == s[i]) {
        p[i] = j + 2;
        break;
      }
      if (j <= 0) {
        p[i] = 0;
        if (s[0] == s[i]) {
          p[i]++;
        }
        break;
      }
      j = p[j] - 1;
    }
    per = i - p[i] + 1;
    int pers = (i + 1) / per;
    if ((i + 1) % per) {
      if (pers % (k) == 0) {
        ans[i] = '1';
      }
    } else {
      if (pers % k == 0 || pers % (k + 1) == 0) {
        ans[i] = '1';
      }
    }
    if (k == 1) {
      ans[i] = '1';
    }
    int tt = pers / k;
    int rr = i + 1 - tt * k * per;
    if (rr <= tt * per) {
      ans[i] = '1';
    }
  }
  cout << ans;
  return 0;
}
