#include <bits/stdc++.h>
using namespace std;
const int N = 55;
int n, a[N];
long long f[N][2][2];
long long dp(int x, bool p, bool q) {
  long long &tmp = f[x][p][q];
  if (~tmp) return tmp;
  if (x * 2 >= n) return (tmp = 1ll);
  tmp = 0;
  for (int i = 0; i < 2; ++i) {
    if (a[x] < 0 || a[x] == i)
      for (int j = 0; j < 2; ++j) {
        if (a[n - 1 - x] < 0 || a[n - 1 - x] == j)
          if ((i == j || x * 2 + 1 != n) && (p || i <= j) && (q || i <= 1 - j))
            tmp += dp(x + 1, p || i < j, q || i < 1 - j);
      }
  }
  return tmp;
}
int main() {
  long long k;
  cin >> n >> k;
  k++;
  memset(f, -1, sizeof(f));
  memset(a, -1, sizeof(a));
  if (dp(0, 0, 0) < k) {
    printf("-1");
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    memset(f, -1, sizeof(f));
    a[i] = 0;
    if (dp(0, 0, 0) < k) {
      a[i] = 1;
      k -= dp(0, 0, 0);
    }
    printf("%d", a[i]);
  }
  return 0;
}
