#include <bits/stdc++.h>
using namespace std;
const long long maxn = 50 + 5;
const long long mod = 1e9 + 7;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, k;
long long a[maxn];
long long dp[maxn][2][2];
long long dfs(long long pos, long long x, long long y) {
  if (pos < n - pos + 1) return 1;
  if (dp[pos][x][y] != -1) return dp[pos][x][y];
  long long res = 0;
  for (register long long i = 0; i < 2; ++i) {
    if (a[pos] == -1 || a[pos] == i)
      for (register long long j = 0; j < 2; ++j) {
        if (a[n - pos + 1] == -1 || a[n - pos + 1] == j) {
          if ((x && i > j) || (y && i > (j ^ 1)) ||
              (pos == n - pos + 1 && i != j))
            continue;
          res = res + dfs(pos - 1, x && (i == j), y && (i != j));
        }
      }
  }
  return dp[pos][x][y] = res;
}
signed main() {
  n = read(), k = read();
  k++;
  memset(a, -1, sizeof(a));
  memset(dp, -1, sizeof(dp));
  a[n] = 0;
  long long wns = dfs(n, 1, 1);
  if (wns < k) {
    printf("-1\n");
    return 0;
  } else {
    for (register long long i = n - 1; i >= 1; --i) {
      a[i] = 0;
      memset(dp, -1, sizeof(dp));
      long long val = dfs(n, 1, 1);
      if (k > val) {
        k -= val;
        a[i] = 1;
      }
    }
    for (register long long i = n; i >= 1; --i) {
      printf("%d", a[i]);
    }
    printf("\n");
  }
  return 0;
}
