#include <bits/stdc++.h>
long long n, k, f[60][2][2], s[60];
long long F(long long x, long long a, long long b) {
  long long& g = f[x][a][b];
  if (x + x >= n || g != -1) return g = (g == -1 ? 1 : g);
  g = 0;
  for (int i = 0; i < 2; i++)
    if (s[x] == -1 || i == s[x])
      for (int j = 0; j < 2; j++)
        if ((x + x + 1 != n || i == j) &&
            (s[n - x - 1] == -1 || j == s[n - x - 1]))
          if ((a || i <= j) && (b || i + j < 2))
            g += F(x + 1, a || i < j, b || i + j < 1);
  return g;
}
int main() {
  scanf("%I64d%I64d", &n, &k), k++, memset(f, -1, sizeof f),
      memset(s, -1, sizeof s);
  if (F(0, 0, 0) < k) return puts("-1"), 0;
  for (int i = 0; i < n; i++)
    memset(f, -1, sizeof f), s[i] = 0,
                             s[i] = F(0, 0, 0) >= k ? 0 : (k -= F(0, 0, 0), 1);
  for (int i = 0; i < n; i++) putchar(s[i] + 48);
}
