#include <bits/stdc++.h>
using namespace std;
int N, H;
long long K;
long long f[52][2][2];
int p[52], all0;
long long dfs(int nw, int R, int I) {
  if (f[nw][R][I] != -1) return f[nw][R][I];
  if (nw * 2 > N) {
    if (N % 2) {
      int yl = 0;
      if (p[nw] != 1) yl++;
      if (p[nw] != 0 && I) yl++;
      return yl;
    }
    return 1;
  }
  long long yl = 0;
  if (p[nw] != 1) {
    if (p[N - nw + 1] != 0) yl += dfs(nw + 1, R | 1, I);
    if (p[N - nw + 1] != 1) yl += dfs(nw + 1, R, I | 1);
  }
  if (p[nw] != 0) {
    if (p[N - nw + 1] != 0 && I) yl += dfs(nw + 1, R, I);
    if (p[N - nw + 1] != 1 && R) yl += dfs(nw + 1, R, I);
  }
  return f[nw][R][I] = yl;
}
int main() {
  scanf("%d", &N);
  cin >> K;
  memset(p, -1, sizeof(p));
  memset(f, -1, sizeof(f));
  p[1] = 0;
  if (N == 1 && K == 1) {
    printf("1");
    return 0;
  }
  if (dfs(1, 0, 0) - 1 < K) {
    printf("-1\n");
    return 0;
  }
  printf("0");
  memset(f, -1, sizeof(f));
  for (int i = 2; i <= N; i++) {
    p[i] = 0;
    long long tll = dfs(1, 0, 0);
    if (!all0) tll--;
    memset(f, -1, sizeof(f));
    if (tll >= K) {
      printf("0");
    } else {
      K -= tll;
      printf("1");
      p[i] = all0 = 1;
    }
  }
}
