#include <bits/stdc++.h>
using namespace std;
long long n, k;
int a[55];
long long c[55][55][2][2];
bool visited[55][55][2][2];
long long solve(int l, int r, int can10, int can11) {
  if (l > r) {
    return 1;
  }
  if (visited[l][r][can10][can11]) {
    return c[l][r][can10][can11];
  }
  visited[l][r][can10][can11] = true;
  long long& ans = c[l][r][can10][can11];
  ans = 0;
  for (int nl = 0; nl < 2; ++nl) {
    if (a[l] != -1 && a[l] != nl) {
      continue;
    }
    for (int nr = 0; nr < 2; ++nr) {
      if (a[r] != -1 && a[r] != nr) {
        continue;
      }
      if (!can10 && nl > nr) {
        continue;
      }
      if (!can11 && nl && nr) {
        continue;
      }
      if (l == r && nl != nr) {
        continue;
      }
      ans += solve(l + 1, r - 1, can10 || nl < nr, can11 || (!nl && !nr));
    }
  }
  return ans;
}
int main() {
  cin >> n >> k;
  k++;
  memset(a, -1, sizeof(a));
  a[0] = 0;
  if (solve(0, n - 1, 0, 0) < k) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 1; i < n; ++i) {
    memset(visited, 0, sizeof(visited));
    a[i] = 0;
    if (k > solve(0, n - 1, 0, 0)) {
      k -= solve(0, n - 1, 0, 0);
      a[i] = 1;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << a[i];
  }
  cout << endl;
  return 0;
}
