#include <bits/stdc++.h>
using namespace std;
int powmod(int a, int b) {
  int tmp = 1;
  a %= (1000000007);
  for (; b; b >>= 1) {
    if (b & 1) tmp = (long long)tmp * a % (1000000007);
    a = (long long)a * a % (1000000007);
  }
  return tmp;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template <class T>
inline void R(T &xx) {
  xx = 0;
  char ch = getchar();
  bool F = 0;
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') F = 1, ch = getchar();
  while (ch >= '0' && ch <= '9')
    xx = xx + xx + (xx << 3) + ch - 48, ch = getchar();
  if (F) xx = -xx;
}
template <class T>
inline void add(int &x, T y) {
  for (x += y; x >= (1000000007); x -= (1000000007))
    ;
}
int n, s[60];
long long k, f[60][2][2];
long long dp(int t, bool a, bool b) {
  long long &g = f[t][a][b];
  if (~g) return g;
  g = 0;
  if (t + t >= n) return g = 1;
  for (int i = 0; i < (int)2; i++)
    if (s[t] < 0 || s[t] == i)
      for (int j = 0; j < (int)2; j++)
        if (s[n - 1 - t] < 0 || s[n - 1 - t] == j)
          if (((t << 1 | 1) != n || i == j) && (a || i <= j) &&
              (b || i + j <= 1))
            g += dp(t + 1, a | i < j, b | i + j < 1);
  return g;
}
int main() {
  R(n);
  R(k);
  k++;
  memset(f, -1, sizeof(f)), memset(s, -1, sizeof(s));
  if (dp(0, 0, 0) < k) return puts("-1"), 0;
  for (int i = 0; i < (int)n; i++) {
    s[i] = 0;
    memset(f, -1, sizeof(f));
    if (dp(0, 0, 0) < k) s[i] = 1, k -= f[0][0][0];
  }
  for (int i = 0; i < (int)n; i++) putchar(s[i] + 48);
  puts("");
  return 0;
}
