#include <bits/stdc++.h>
using namespace std;
long long a[60], b[60], c[60];
long long n, l, K;
bool check() {
  long long i;
  for (i = 1; i <= n; i++) c[i] = b[n - i + 1];
  if (c[1] == 1)
    for (i = 1; i <= n; i++) c[i] = !c[i];
  for (i = 1; i <= n; i++) {
    if (b[i] < c[i]) return true;
    if (b[i] > c[i]) return false;
  }
  return true;
}
long long solve2(long long x) {
  return ((1ll << x) + (1ll << ((x + 1) / 2)) + (1ll << x) +
          (x & 1 ? 0 : (1ll << ((x + 1) / 2)))) >>
         1;
}
long long _min(long long x, long long y) { return x < y ? x : y; }
long long solve() {
  if (a[1] == 1) return 0;
  long long i, j, k;
  long long tmp = 0;
  for (i = 2; i <= _min(l, n - l); i++) tmp = (tmp << 1) + (!a[i]);
  if (2 * l <= n) return 2 * tmp * (1ll << (n - 2 * l)) + solve2(n - 2 * l);
  tmp <<= 1;
  if (l == n) {
    for (i = 1; i <= n; i++) b[i] = a[i];
    if (check()) tmp++;
  } else {
    for (i = 1; i <= n; i++) b[i] = i <= l ? a[i] : a[n - i + 1];
    if (check()) tmp++;
    for (i = 1; i <= n; i++) b[i] = i <= l ? a[i] : !a[n - i + 1];
    if (check()) tmp++;
  }
  return tmp;
}
bool dfs(long long x) {
  if (l == n + 1) return true;
  a[++l] = 0;
  long long tmp = solve();
  if (tmp >= x) return dfs(x);
  a[l] = 1;
  long long tmp2 = solve();
  if (tmp + tmp2 < x) return false;
  return dfs(x - tmp);
}
int main() {
  long long i, j, k;
  scanf("%I64d%I64d", &n, &K);
  K++;
  if (!dfs(K)) {
    printf("-1\n");
    return 0;
  }
  for (i = 1; i <= n; i++) printf("%I64d", a[i]);
  return 0;
}
