#include <bits/stdc++.h>
using namespace std;
long long f[60][60][2][2], m;
int n, a[100];
bool vis[60][60][2][2];
long long work(int l, int r, int rev, int inv) {
  if (l > r) return 1;
  if (vis[l][r][rev][inv]) return f[l][r][rev][inv];
  vis[l][r][rev][inv] = 1;
  long long &ans = f[l][r][rev][inv];
  ans = 0;
  for (int i = 0; i <= 1; i++)
    if (a[l] == -1 || a[l] == i)
      for (int j = 0; j <= 1; j++)
        if (a[r] == -1 || a[r] == j)
          if (l < r || i == j)
            if (rev || i <= j)
              if (inv || i <= 1 - j)
                ans += work(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 (work(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 now = work(0, n - 1, 0, 0);
    if (now < m) m -= now, a[i] = 1;
  }
  for (int i = 0; i < n; i++) printf("%d", a[i]);
}
