#include <bits/stdc++.h>
using namespace std;
const int MAXR = 10000000;
char _READ_[MAXR], _PRINT_[MAXR];
int _READ_POS_, _PRINT_POS_, _READ_LEN_;
inline char readc() {
  if (!_READ_POS_) _READ_LEN_ = fread(_READ_, 1, MAXR, stdin);
  char c = _READ_[_READ_POS_++];
  if (_READ_POS_ == MAXR) _READ_POS_ = 0;
  if (_READ_POS_ > _READ_LEN_) return 0;
  return c;
}
template <typename T>
inline void read(T &x) {
  x = 0;
  register int flag = 1, c;
  while (((c = readc()) < '0' || c > '9') && c != '-')
    ;
  if (c == '-')
    flag = -1;
  else
    x = c - '0';
  while ((c = readc()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= flag;
}
template <typename T1, typename... T2>
inline void read(T1 &a, T2 &...x) {
  read(a), read(x...);
}
inline int reads(char *s) {
  register int len = 0, c;
  while (isspace(c = readc()) || !c)
    ;
  s[len++] = c;
  while (!isspace(c = readc()) && c) s[len++] = c;
  s[len] = 0;
  return len;
}
inline void ioflush() {
  fwrite(_PRINT_, 1, _PRINT_POS_, stdout), _PRINT_POS_ = 0;
  fflush(stdout);
}
inline void printc(char c) {
  _PRINT_[_PRINT_POS_++] = c;
  if (_PRINT_POS_ == MAXR) ioflush();
}
inline void prints(char *s) {
  for (int i = 0; s[i]; i++) printc(s[i]);
}
template <typename T>
inline void print(T x, char c = '\n') {
  if (x < 0) printc('-'), x = -x;
  if (x) {
    static char sta[20];
    register int tp = 0;
    for (; x; x /= 10) sta[tp++] = x % 10 + '0';
    while (tp > 0) printc(sta[--tp]);
  } else
    printc('0');
  printc(c);
}
template <typename T1, typename... T2>
inline void print(T1 x, T2... y) {
  print(x, ' '), print(y...);
}
int n, cer[55];
long long m, f[55][2][2];
long long check() {
  memset(f, 0, sizeof(f));
  f[0][1][1] = 1;
  int l = n / 2, flag = 1;
  for (int i = 1; i <= l; i++) {
    int j = n - i + 1;
    if (cer[i] > 0 || cer[j] > 0) flag = 0;
    for (int a = 0; a < 2; a++)
      if (cer[i] < 0 || a == cer[i])
        for (int b = 0; b < 2; b++)
          if (cer[j] < 0 || b == cer[j])
            for (int c = 0; c < 2; c++)
              for (int d = 0; d < 2; d++) {
                int p = a == b && c > 0, q = a != b && d > 0;
                if (!(a > b && c) && !(a > !b && d))
                  f[i][p][q] += f[i - 1][c][d];
              }
  }
  if (cer[l + 1] > 0) flag = 0;
  if (n & 1)
    return (f[l][0][0] + f[l][1][0]) * (1 + (cer[l + 1] < 0)) +
           (f[l][0][1] + f[l][1][1]) * (cer[l + 1] <= 0) - flag;
  else
    return f[l][0][0] + f[l][1][0] + f[l][0][1] + f[l][1][1] - flag;
}
int main() {
  read(n, m);
  memset(cer, -1, sizeof(cer));
  cer[1] = 0;
  if (check() < m) return puts("-1") * 0;
  for (int i = 2; i <= n; i++) {
    cer[i] = 0;
    long long t = check();
    if (t < m) cer[i] = 1, m -= t;
  }
  for (int i = 1; i <= n; i++) printc(cer[i] + '0');
  ioflush();
  return 0;
}
