#include <bits/stdc++.h>
using namespace std;
template <typename Tp>
void read(Tp &x) {
  x = 0;
  int op = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') op = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= op;
}
template <typename Tp>
void CMax(Tp &x, Tp y) {
  if (y > x) x = y;
}
template <typename Tp>
void CMin(Tp &x, Tp y) {
  if (y < x) x = y;
}
const int N = 55;
int n, m;
long long k;
long long f[N][2][2];
int c[N];
long long DP(int pos, int lead1, int lead2) {
  long long &cur = f[pos][lead1][lead2];
  if (cur != -1) return cur;
  if (pos == m) return cur = 1;
  cur = 0;
  for (int i = (0); i <= (1); ++i)
    for (int j = (0); j <= (1); ++j) {
      if (!lead1 && i == 1 && j == 0) continue;
      if (!lead2 && i == 1 && j == 1) continue;
      if (c[pos + 1] != -1 && c[pos + 1] != i) continue;
      if (c[n - pos] != -1 && c[n - pos] != j) continue;
      if ((n & 1) && pos + 1 == m && i != j) continue;
      cur +=
          DP(pos + 1, lead1 | (i == 0 && j == 1), lead2 | (i == 0 && j == 0));
    }
  return cur;
}
long long calc() {
  memset(f, -1, sizeof(f));
  return DP(0, 0, 0);
}
int main() {
  read(n);
  read(k);
  k++;
  m = (n + 1) >> 1;
  memset(c, -1, sizeof(c));
  c[1] = 0;
  long long v = calc();
  if (v < k) {
    puts("-1");
    return 0;
  }
  for (int i = (2); i <= (n); ++i) {
    c[i] = 0;
    v = calc();
    if (k - v > 0) k -= v, c[i] = 1;
  }
  if (k != 1) {
    puts("-1");
    return 0;
  }
  for (int i = (1); i <= (n); ++i) printf("%d", c[i]);
  return 0;
}
