#include <bits/stdc++.h>
using namespace std;
long long dp[26][2][2];
char s[55] = {0};
int n;
long long F(int u, int x, int y) {
  if (u << 1 >= n) return 1;
  long long &v = dp[u][x][y];
  if (v != -1)
    return v;
  else
    v = 0;
  for (int i = 48; i <= 49; ++i) {
    if (s[u] != i && s[u]) continue;
    for (int j = 48; j <= 49; ++j) {
      if (((u << 1 | 1) != n || i == j) &&
          (s[n - u - 1] == j || !s[n - u - 1]) && (x || (i <= j)) &&
          (y || (i + j < 98))) {
        v += F(u + 1, (x || i < j), (y || i + j == 96));
      }
    }
  }
  return v;
}
int main() {
  long long k, t;
  scanf("%d%I64d", &n, &k);
  ++k;
  memset(dp, -1, sizeof(dp));
  if (k > F(0, 0, 0)) {
    puts("-1");
    return 0;
  }
  s[0] = '0', s[n] = 0;
  for (int i = 1; i < n; ++i) {
    memset(dp, -1, sizeof(dp));
    s[i] = '0', t = F(0, 0, 0);
    if (k > t) s[i] = '1', k -= t;
  }
  puts(s);
  return 0;
}
