#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAX{2 * 16777220};
bitset<MAX> skip;
int int_log2(ll p) {
  ll mask = 1LL << 31;
  int res = 32;
  while ((mask & p) == 0) {
    --res;
    mask >>= 1;
  }
  return res;
}
string to_bin(ll n, ll size) {
  ostringstream os;
  while (size--) {
    os << (n & 1);
    n >>= 1;
  }
  auto res = os.str();
  reverse(res.begin(), res.end());
  return res;
}
string solve(ll N, ll K) {
  ll psize = (N + 1) / 2, nsize = N / 2;
  ll total = (1LL << nsize) - 1;
  if (K <= total) {
    return to_bin(K, N);
  }
  K -= total;
  for (ll p = 1; p < (1 << (psize - 1)); ++p) {
    total = (1LL << nsize);
    ll mask = (1LL << (psize - 1));
    for (ll bits = 1; bits <= nsize; ++bits, mask >>= 1) {
      if (p & mask) total -= 2 * (1LL << (nsize - bits));
    }
    if ((N % 2) and (p & 1)) {
      total -= 1;
    }
    if (K <= total) {
      mask = (1LL << (psize - 1));
      ll n = 0, m = 0;
      ll shift = p << nsize;
      for (ll bits = 1; bits <= nsize; ++bits, mask >>= 1) {
        if (p & mask) {
          m |= (1LL << (bits - 1));
          for (ll i = 0; i < (1 << (nsize - bits)); ++i) {
            ll x = (p << nsize) | (i << bits) | n;
            ll y = (p << nsize) | (i << bits) | m;
            skip[x - shift] = true;
            skip[y - shift] = true;
          }
          n |= (1LL << (bits - 1));
          m &= ~(1LL << (bits - 1));
        } else
          m |= (1LL << (bits - 1));
      }
      if ((N % 2) and (p & 1)) {
        ll x = (p << nsize) | m;
        skip[x - shift] = true;
      }
      ll next = p << nsize;
      while (skip[next - shift]) ++next;
      while (--K) {
        ++next;
        while (skip[next - shift]) ++next;
      }
      return to_bin(next, N);
    }
    K -= total;
  }
  return "-1";
}
int main() {
  ios::sync_with_stdio(false);
  ll N, K;
  cin >> N >> K;
  auto ans = solve(N, K);
  cout << ans << '\n';
  return 0;
}
