#include <bits/stdc++.h>
using namespace std;
const long long inf = 2147483647;
long long read() {
  long long first = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    first = first * 10 + ch - '0';
    ch = getchar();
  }
  return first * f;
}
void print(long long first) {
  if (first < 0) putchar('-'), first = -first;
  short a[20] = {}, sz = 0;
  while (first > 0) a[sz++] = first % 10, first /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
long long dp[55][5][5];
long long a[55];
long long n, k;
long long dfs(long long pos, long long lim1, long long lim2) {
  if (pos < n - pos + 1) return 1;
  if (dp[pos][lim1][lim2] >= 0) return dp[pos][lim1][lim2];
  long long ans = 0;
  for (long long i = 0; i <= 1; i++) {
    if (a[pos] == i || a[pos] == -1) {
      for (long long j = 0; j <= 1; j++) {
        if (a[n - pos + 1] == j || a[n - pos + 1] == -1) {
          if (lim1 && i > j || lim2 && i > !j || pos == n - pos + 1 && i != j)
            continue;
          ans = ans + dfs(pos - 1, lim1 && (i == j), lim2 && (i != j));
        }
      }
    }
  }
  return dp[pos][lim1][lim2] = ans;
}
int main() {
  n = read(), k = read();
  memset(a, -1, sizeof(a));
  memset(dp, -1, sizeof(dp));
  k++;
  a[n] = 0;
  if (dfs(n, 1, 1) < k) {
    puts("-1");
    return 0;
  }
  cout << 0;
  for (long long i = n - 1; i >= 1; i--) {
    a[i] = 0;
    memset(dp, -1, sizeof(dp));
    long long nw = dfs(n, 1, 1);
    if (nw < k) {
      a[i] = 1;
      cout << 1;
      k -= nw;
    } else {
      cout << 0;
    }
  }
  return 0;
}
