#include <bits/stdc++.h>
using namespace std;
const int maxn = 55;
long long f[maxn][2][2], k;
int s[maxn], n;
long long calc(int i, int p, int q) {
  int a, b;
  long long &t = f[i][p][q];
  if (t != -1) return t;
  if (i * 2 >= n) {
    t = 1;
    return t;
  }
  t = 0;
  for (a = 0; a < 2; ++a)
    if (s[i] < 0 || s[i] == a)
      for (b = 0; b < 2; ++b)
        if (s[n - i - 1] < 0 || s[n - i - 1] == b)
          if ((i * 2 + 1 != n || a == b) && (p || a <= b) && (q || !a || !b))
            t += calc(i + 1, p || a < b, q || (!a && !b));
  return t;
}
int main() {
  scanf("%d%I64d", &n, &k);
  ++k;
  memset(f, 255, sizeof f);
  memset(s, 255, sizeof s);
  if (calc(0, 0, 0) < k) {
    puts("-1");
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    memset(f, 255, sizeof f);
    s[i] = 0;
    if (calc(0, 0, 0) < k) {
      s[i] = 1;
      k -= calc(0, 0, 0);
    }
    printf("%d", s[i]);
  }
  printf("\n");
  return 0;
}
