#include <bits/stdc++.h>
using namespace std;
long long f[55][2][2], K;
int a[55], n;
long long calc(int l, int r, int e1, int e2) {
  if (l > r) return 1;
  if (~(f[l][e1][e2])) return (f[l][e1][e2]);
  (f[l][e1][e2]) = 0;
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j)
      if (a[l] != (!i) && a[r] != (!j) && (l < r || i == j) && (e1 || i <= j) &&
          (e2 || i <= (!j)))
        (f[l][e1][e2]) += calc(l + 1, r - 1, e1 || (i < j), e2 || (i < !j));
  return (f[l][e1][e2]);
}
int main() {
  scanf("%d%I64d", &n, &K);
  memset(a, -1, sizeof a);
  a[1] = 0;
  memset(f, -1, sizeof f);
  if (calc(1, n, 0, 0) < ++K) {
    puts("-1");
    return 0;
  }
  for (int i = 2; i <= n; ++i) {
    a[i] = 0, memset(f, -1, sizeof f);
    long long d = calc(1, n, 0, 0);
    K -= (a[i] = (d < K)) * d;
  }
  for (int i = 1; i <= n; ++i) printf("%d", a[i]);
  puts("");
}
