#include <bits/stdc++.h>
using namespace std;
long long f[60][2][2], m;
int g[60][2], a[60], n;
inline long long F(int l) {
  memset(f, 0, sizeof(f));
  memset(g, 0, sizeof(g));
  for (int i = 1; i <= n; i++)
    g[i][0] = (a[i] == 0 || a[i] == 2), g[i][1] = (a[i] == 1 || a[i] == 2);
  f[0][1][1] = 1;
  for (int pre = 1, suf = n; pre <= suf; pre++, suf--)
    for (int s1 = 0; s1 <= 1; s1++)
      for (int s2 = 0; s2 <= 1; s2++)
        for (int a = 0; a <= 1; a++)
          if (g[pre][a])
            for (int b = 0; b <= 1; b++)
              if (g[suf][b]) {
                if (s1 && a > b) continue;
                if (s2 && a > 1 - b) continue;
                if (pre == suf && a != b) continue;
                if (pre == 1 && a == 1) continue;
                f[pre][s1 & (a >= b)][s2 & (a >= 1 - b)] += f[pre - 1][s1][s2];
              }
  long long sum = 0;
  for (int i = 0; i <= 1; i++)
    for (int j = 0; j <= 1; j++) sum += f[(1 + n) / 2][i][j];
  return (sum);
}
int main() {
  scanf("%d%I64d", &n, &m);
  long long Sum = 0;
  for (int i = 3; i <= n; i++) a[i] = 2;
  a[2] = 0, Sum += F(0), a[2] = 1, Sum += F(0);
  if (Sum <= m) {
    puts("-1");
    return (0);
  }
  a[1] = 0;
  for (int i = 2; i <= n; i++) a[i] = 2;
  for (int i = 2; i <= n; i++) {
    a[i] = 0;
    long long now = F(i);
    if (m - now >= 0) a[i] = 1, m -= now;
  }
  if (m) {
    puts("-1");
    return (0);
  }
  for (int i = 1; i <= n; i++) printf("%d", a[i]);
  puts("");
}
