#include <bits/stdc++.h>
using namespace std;
bool done1[33][2][2], done2[33][2][2], done3[33][2][2];
long long memo1[33][2][2], memo2[33][2][2], memo3[33][2][2];
long long lim;
int n;
long long dp1(int, int, int);
long long dp2(int, int, int);
long long dp3(int, int, int);
long long dp1(int i, int s1, int s2) {
  if (done1[i][s1][s2]) return memo1[i][s1][s2];
  done1[i][s1][s2] = true;
  long long &ret = memo1[i][s1][s2] = 0;
  int hd = (((lim) >> (n - 1 - i)) & 1), rr = (((lim) >> (i)) & 1);
  if (i * 2 + 1 == n) {
    if (!s1)
      ret = 1;
    else if (s2)
      ret = hd != 0;
    else {
      ret = 1;
    }
  } else if (i * 2 == n) {
    if (s1 && s2)
      ret = 0;
    else
      ret++;
  } else {
    ret += dp2(i + 1, s1 && hd == 0, 0 > rr || (0 == rr && s2));
    ret += dp3(i + 1, s1 && hd == 0, 1 > rr || (1 == rr && s2));
  }
  return ret;
}
long long dp2(int i, int s1, int s2) {
  if (done2[i][s1][s2]) return memo2[i][s1][s2];
  done2[i][s1][s2] = true;
  long long &ret = memo2[i][s1][s2] = 0;
  int hd = (((lim) >> (n - 1 - i)) & 1), rr = (((lim) >> (i)) & 1);
  if (i * 2 + 1 == n) {
    if (!s1)
      ret = 2;
    else if (s2)
      ret = hd != 0;
    else {
      ret = hd + 1;
    }
  } else if (i * 2 == n) {
    if (s1 && s2)
      ret = 0;
    else
      ret++;
  } else {
    for (int x = 0; x <= (s1 ? hd : 1); x++)
      ret += dp2(i + 1, s1 && hd == x, x > rr || (x == rr && s2));
    int ns1 = s1 && hd == 0, ns2 = 1 > rr || (1 == rr && s2);
    if (!ns1)
      ret += 1LL << (n - 2 * (i + 1));
    else
      ret += ((lim >> (i + 1)) & ((1LL << (n - 2 * (i + 1))) - 1)) + 1;
    if (ns1 && ns2) ret--;
  }
  return ret;
}
long long dp3(int i, int s1, int s2) {
  if (done3[i][s1][s2]) return memo3[i][s1][s2];
  done3[i][s1][s2] = true;
  long long &ret = memo3[i][s1][s2] = 0;
  int hd = (((lim) >> (n - 1 - i)) & 1), rr = (((lim) >> (i)) & 1);
  if (i * 2 + 1 == n) {
    if (!s1)
      ret = 1;
    else if (s2)
      ret = hd != 0;
    else {
      ret = 1;
    }
  } else if (i * 2 == n) {
    if (s1 && s2)
      ret = 0;
    else
      ret++;
  } else {
    ret += dp3(i + 1, s1 && hd == 0, 1 > rr || (1 == rr && s2));
    if (!s1 || hd == 1)
      ret += dp3(i + 1, s1 && hd == 1, 0 > rr || (0 == rr && s2));
    int ns1 = s1 && hd == 0, ns2 = 0 > rr || (0 == rr && s2);
    if (!ns1)
      ret += 1LL << (n - 2 * (i + 1));
    else
      ret += ((lim >> (i + 1)) & ((1LL << (n - 2 * (i + 1))) - 1)) + 1;
    if (ns1 && ns2) ret--;
  }
  return ret;
}
void output(long long x, int n) {
  for (int i = 0; i < n; i++) cout << (((x) >> (n - i - 1)) & 1);
  cout << '\n';
}
long long work(long long LIM) {
  lim = LIM;
  memset(done1, 0, sizeof(done1));
  memset(done2, 0, sizeof(done2));
  memset(done3, 0, sizeof(done3));
  return dp1(0, 1, 0);
}
int main() {
  long long rank;
  cin >> n >> rank;
  rank++;
  long long lb = 0, rb = (1LL << n) - 1;
  for (long long mid = (lb + rb) / 2; lb < rb - 1; mid = (lb + rb) / 2) {
    if (work(mid) >= rank)
      rb = mid;
    else
      lb = mid;
  }
  if (work(rb) == rank)
    output(rb, n);
  else
    printf("-1\n");
}
