#include <bits/stdc++.h>
int cmp(long long a, long long b) { return a == b ? 0 : a < b ? -1 : 1; }
int main() {
  int n, i, j, zero;
  long long k, l, r, cnt, a, a_;
  scanf("%d%lld", &n, &k);
  l = 1;
  r = 1LL << (n / 2 - 1);
  cnt = (l + r) * (r - l + 1);
  if (n % 2 == 1) cnt = cnt + (cnt - (r - l + 1));
  if (k >= cnt) {
    printf("-1\n");
    return 0;
  }
  printf("0");
  a = 0;
  for (i = 1; i < n / 2; i++) {
    r = (1LL << (n / 2 - 1)) - a;
    l = r - ((1LL << (n / 2 - 1 - i)) - 1);
    cnt = (l + r) * (r - l + 1);
    if (n % 2 == 1) cnt = cnt + (cnt - (r - l + 1));
    if (k >= cnt) {
      k -= cnt;
      a |= 1LL << (n / 2 - 1 - i);
      printf("1");
    } else
      printf("0");
  }
  zero = 1;
  if (n % 2 == 1) {
    l = r = (1LL << (n / 2 - 1)) - a;
    cnt = (l + r) * (r - l + 1);
    if (k >= cnt) {
      k -= cnt;
      zero = 0;
      printf("1");
    } else {
      zero = 1;
      printf("0");
    }
  }
  a_ = 0;
  for (i = (n + 1) / 2; i < n; i++) {
    int cmp1 = cmp(a_, a % (1LL << (i - (n - 1) / 2)));
    int cmp2 = cmp(a_ ^ ((1LL << (i - (n - 1) / 2)) - 1),
                   a % (1LL << (i - (n - 1) / 2)));
    cnt = 0;
    for (j = n - 2; j > i; j--)
      if ((a & 1LL << (n / 2 - 1 - (n - 1 - j))) == 0)
        cnt += 1LL << (j - i - 1);
    cnt *= 2;
    if (cmp1 >= 0) cnt++;
    if (i < n - 1 && (cmp2 > 0 || (cmp2 == 0 && zero))) cnt++;
    if (k >= cnt) {
      k -= cnt;
      a_ |= 1LL << (i - (n + 1) / 2);
      printf("1");
    } else
      printf("0");
  }
  printf("\n");
  return 0;
}
