#include <bits/stdc++.h>
using namespace std;
const int N = 55;
int n;
int ans[N];
long long k;
long long f[N][2][2];
long long solve() {
  memset(f, 0, sizeof(f));
  bool t = 1;
  for (int i = (1); i < (n + 1); ++i)
    if (ans[i] == 1) t = 0;
  f[0][1][1] = 1;
  for (int p = (0); p < (n / 2); ++p)
    for (int i = (0); i < (2); ++i)
      for (int j = (0); j < (2); ++j)
        if (f[p][i][j])
          for (int x = (0); x < (2); ++x)
            if (ans[p + 1] != (x ^ 1)) {
              for (int y = (0); y < (2); ++y)
                if (ans[n - p] != (y ^ 1)) {
                  if (i && x > y) continue;
                  if (j && x > (y ^ 1)) continue;
                  int ni = (i && x == y), nj = (j && x == (y ^ 1));
                  f[p + 1][ni][nj] += f[p][i][j];
                }
            }
  long long res = 0;
  if (n & 1) {
    for (int x = (0); x < (2); ++x)
      if (ans[n / 2 + 1] != (x ^ 1))
        for (int i = (0); i < (2); ++i)
          for (int j = (0); j < (2); ++j) {
            if (j && x > (x ^ 1)) continue;
            res += f[n / 2][i][j];
          }
  } else {
    for (int i = (0); i < (2); ++i)
      for (int j = (0); j < (2); ++j) res += f[n / 2][i][j];
  }
  return res - t;
}
int main() {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
  cin >> n >> k;
  memset(ans, -1, sizeof(ans));
  ans[1] = 0;
  if (solve() < k) {
    cout << -1 << "\n";
    return 0;
  }
  for (int i = (1); i < (n + 1); ++i) {
    ans[i] = 0;
    long long t = solve();
    if (k > t) {
      ans[i] = 1;
      k -= t;
    }
  }
  for (int i = (1); i < (n + 1); ++i) cout << ans[i];
  cout << "\n";
  return 0;
}
