#include <bits/stdc++.h>
using namespace std;
int n, a[100];
bool vis[55][55][2][2];
long long dp[55][55][2][2];
long long m;
long long solve(int l, int r, int rev, int inv) {
  if (l > r) return 1;
  if (vis[l][r][rev][inv]) return dp[l][r][rev][inv];
  vis[l][r][rev][inv] = 1;
  long long &ans = dp[l][r][rev][inv];
  ans = 0;
  for (int i = 0; i < 2; i++) {
    if (a[l] == -1 || a[l] == i) {
      for (int j = 0; j < 2; j++) {
        if (a[r] == -1 || a[r] == j) {
          if (l < r || i == j) {
            if (rev || i <= j) {
              if (inv || i <= 1 - j) {
                ans = ans + solve(l + 1, r - 1, i < j || rev, i < 1 - j || inv);
              }
            }
          }
        }
      }
    }
  }
  return ans;
}
int main() {
  cin >> n >> m;
  m++;
  memset(a, -1, sizeof(a));
  a[0] = 0;
  if (solve(0, n - 1, 0, 0) < m) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i < n; i++) {
    memset(vis, 0, sizeof(vis));
    a[i] = 0;
    long long cur = solve(0, n - 1, 0, 0);
    if (cur < m) {
      m -= cur;
      a[i] = 1;
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d", a[i]);
  }
  return 0;
}
