#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100;
long long dp[MAXN][2][2];
long long n, np;
long long rem;
int s[MAXN];
long long f(int p, int less, int lessrev) {
  long long ret;
  int i;
  if (dp[p][less][lessrev] != -1) return dp[p][less][lessrev];
  if (p >= n) {
    if (less && lessrev) {
      dp[p][less][lessrev] = 1;
      return 1;
    } else {
      dp[p][less][lessrev] = 0;
      return 0;
    }
  }
  ret = 0;
  for (int i = 0; i <= 1; i++) {
    int nless = less;
    int nlessrev = lessrev;
    if (i > s[n - 1 - p]) {
      nless = 1;
    } else if (i < s[n - 1 - p]) {
      nless = 0;
    }
    if (1 - i > s[n - 1 - p]) {
      nlessrev = 1;
    }
    if (1 - i < s[n - 1 - p]) {
      nlessrev = 0;
    }
    ret += f(p + 1, nless, nlessrev);
  }
  dp[p][less][lessrev] = ret;
  return ret;
}
int main() {
  cin >> n >> rem;
  rem++;
  int p, i, j, fp, less, lessrev, nless, nlessrev;
  bool fd;
  long long t;
  np = n / 2 + n % 2;
  memset(dp, -1, sizeof(dp));
  memset(s, 0, sizeof(s));
  fd = false;
  for (p = 0; p < (1 << np); ++p) {
    if (p > 0) {
      i = np - 1;
      while (i >= 0) {
        if (s[i] == 0) {
          s[i] = 1;
          break;
        }
        s[i] = 0;
        i--;
      }
      for (j = n - np; j <= n - 1 - i; ++j) {
        dp[j][0][0] = -1;
        dp[j][0][1] = -1;
        dp[j][1][0] = -1;
        dp[j][1][1] = -1;
      }
    }
    fp = np;
    less = 1;
    lessrev = 1;
    if (n % 2 == 1 && s[np - 1] == 1) lessrev = 0;
    t = f(fp, less, lessrev);
    if (t < rem)
      rem -= t;
    else {
      fd = true;
      break;
    }
  }
  if (!fd) {
    cout << "-1" << endl;
    return 0;
  }
  less = 1;
  lessrev = 1;
  if (n % 2 == 1 && s[np - 1] == 1) lessrev = 0;
  for (p = np; p < n; ++p) {
    nless = less;
    nlessrev = lessrev;
    if (0 < s[n - 1 - p]) nless = 0;
    if (1 > s[n - 1 - p]) nlessrev = 1;
    t = f(p + 1, nless, nlessrev);
    if (t >= rem) {
      s[p] = 0;
      less = nless;
      lessrev = nlessrev;
      continue;
    }
    rem -= t;
    s[p] = 1;
    if (1 > s[n - 1 - p]) less = 1;
    if (0 < s[n - 1 - p]) lessrev = 0;
  }
  for (i = 0; i < n; i++) {
    cout << s[i];
  }
  cout << endl;
  return 0;
}
