#include <bits/stdc++.h>
using namespace std;
long long n, m, f[1001][2][2], s[1001];
long long F(long long u, long long x, long long y) {
  long long &g = f[u][x][y];
  int i, j;
  if (2 * u >= n) return 1;
  if (g != -1) return g;
  g = 0;
  for (i = 0; i <= 1; i++)
    if (s[u] == -1 || s[u] == i)
      for (j = 0; j <= 1; j++)
        if ((u * 2 + 1 != n || i == j) &&
            (s[n - u - 1] == j || s[n - u - 1] == -1) && (x || (i <= j)) &&
            (y || (i + j < 2)))
          g += F(u + 1, (x || (i < j)), (y || (i + j == 0)));
  return g;
}
int main() {
  scanf("%I64d%I64d", &n, &m);
  m++;
  memset(f, -1, sizeof(f));
  memset(s, -1, sizeof(s));
  if (F(0, 0, 0) < m) {
    printf("-1\n");
    return 0;
  }
  for (int i = 0; i < n; i++) {
    memset(f, -1, sizeof(f));
    s[i] = 0;
    long long k = F(0, 0, 0);
    if (k < m) {
      s[i] = 1;
      m -= k;
    }
  }
  for (int i = 0; i < n; i++) printf("%I64d", s[i]);
  printf("\n");
  return 0;
}
