#include <bits/stdc++.h>
using namespace std;
vector<vector<vector<map<string, long long> > > > mem_count;
long long count(int n, int can10, int can11, string prefix) {
  if (int(prefix.size()) > n) return 0;
  if (n == 0) return 1;
  if (n == 1) {
    long long ret = 0;
    if (prefix == "" || prefix == "0") ++ret;
    if ((prefix == "" || prefix == "1") && can11 != 0) ++ret;
    return ret;
  }
  map<string, long long>::iterator it = mem_count[n][can10][can11].find(prefix);
  if (it != mem_count[n][can10][can11].end()) {
    return it->second;
  }
  long long &ret = mem_count[n][can10][can11][prefix];
  ret = 0;
  if (int(prefix.size()) == n) {
    for (int i = 0; i <= n / 2; ++i) {
      string ends = string(1, prefix[i]) + prefix[n - 1 - i];
      if (ends == "00") {
        can11 = 1;
      } else if (ends == "01") {
        can10 = 1;
      } else if (ends == "10") {
        if (can10 == 0) return ret = 0;
      } else {
        if (can11 == 0) return ret = 0;
      }
    }
    return ret = 1;
  }
  string next_prefix = (prefix == "" ? "" : prefix.substr(1));
  if (int(prefix.size()) == 0 || prefix[0] == '0') {
    ret += count(n - 2, can10, 1, next_prefix);
    ret += count(n - 2, 1, can11, next_prefix);
  }
  if (int(prefix.size()) == 0 || prefix[0] == '1') {
    if (can10 != 0) {
      ret += count(n - 2, can10, can11, next_prefix);
    }
    if (can11 != 0) {
      ret += count(n - 2, can10, can11, next_prefix);
    }
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  long long k;
  cin >> n >> k;
  mem_count = vector<vector<vector<map<string, long long> > > >(
      n + 1, vector<vector<map<string, long long> > >(
                 2, vector<map<string, long long> >(2)));
  string s = "";
  for (int i = 0; i < n; ++i) {
    long long c0 = count(n, 0, 0, s + '0');
    if (k < c0) {
      s += '0';
    } else if (k < count(n, 0, 0, s)) {
      s += '1';
      k -= c0;
    } else {
      k = -1;
      break;
    }
  }
  if (k != 0)
    cout << -1 << endl;
  else
    cout << s << endl;
}
