#include <bits/stdc++.h>
using namespace std;
int n, h;
long long m;
long long check(long long x) {
  long long res = (long long)(1LL << h) * x - x * (x - 1);
  if (n & 1) res += res - x;
  return res;
}
int main() {
  int i;
  long long L, R, mid, ans;
  scanf("%d%I64d", &n, &m);
  ++m;
  h = n >> 1;
  for (L = 0, R = 1LL << (h - 1); L < R;) {
    mid = (L + R + 1) >> 1;
    if (check(mid) < m)
      L = mid;
    else
      R = mid - 1;
  }
  ans = L;
  if (ans == (1LL << (h - 1)))
    printf("-1");
  else {
    m -= check(ans);
    for (i = h - 1; i >= 0; --i)
      if ((ans >> i) & 1)
        printf("1");
      else
        printf("0");
    L = ans, R = (1LL << h) - ans - 1;
    if (n & 1) {
      if (m > (1LL << h) - 2 * ans)
        m -= (1LL << h) - 2 * ans, printf("1"), --R;
      else
        printf("0");
    }
    for (i = 0; i < h; ++i) {
      if ((R >> 1) - ((L - 1) >> 1) < m) {
        m -= (R >> 1) - ((L - 1) >> 1);
        printf("1");
        L >>= 1;
        if (R & 1)
          R >>= 1;
        else
          R = (R - 1) >> 1;
      } else {
        printf("0");
        if (L & 1)
          L = (L + 1) >> 1;
        else
          L >>= 1;
        R >>= 1;
      }
    }
  }
  return 0;
}
