#include <bits/stdc++.h>
using namespace std;
int n;
long long k;
int dp[32][2][2];
int solve(int prefix, int pos, bool less, bool compLess) {
  int &ans = dp[pos][less][compLess];
  if (ans != -1) return ans;
  if (pos == n / 2) {
    if (less && compLess) return ans = 1;
    return ans = 0;
  }
  ans = 0;
  if ((prefix >> pos) & 1) {
    ans += solve(prefix, pos + 1, false, compLess);
    ans += solve(prefix, pos + 1, less, false);
  } else {
    ans += solve(prefix, pos + 1, less, true);
    ans += solve(prefix, pos + 1, true, compLess);
  }
  return ans;
}
string findAns(int prefix, int pos, bool less, bool compLess) {
  string ans;
  for (int i = (n - 1) / 2; i >= 0; i--) {
    if ((prefix >> i) & 1)
      ans.push_back('1');
    else
      ans.push_back('0');
  }
  if (n % 2) prefix >>= 1;
  while (pos < n / 2) {
    if ((prefix >> pos) & 1) {
      if (dp[pos + 1][false][compLess] >= k) {
        ans.push_back('0');
        less = false;
      } else {
        k -= dp[pos + 1][false][compLess];
        ans.push_back('1');
        compLess = false;
      }
    } else {
      if (dp[pos + 1][less][true] >= k) {
        ans.push_back('0');
        compLess = true;
      } else {
        k -= dp[pos + 1][less][true];
        ans.push_back('1');
        less = true;
      }
    }
    pos++;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  k++;
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < (1 << ((n - 1) / 2)); i++) {
    if (i) {
      int a = n % 2 ? i >> 1 : i;
      int b = n % 2 ? (i - 1) >> 1 : i - 1;
      if (a ^ b) {
        int pos = 31 - __builtin_clz(a ^ b);
        for (int j = 0; j <= pos; j++) {
          memset(dp[j], -1, sizeof(dp[j]));
        }
      }
    }
    int value;
    int prefix = n % 2 ? i >> 1 : i;
    bool compLess = n % 2 ? !(i & 1) : true;
    value = solve(prefix, 0, true, compLess);
    if (value >= k) {
      cout << findAns(i, 0, true, compLess) << endl;
      return 0;
    } else
      k -= value;
  }
  cout << -1 << endl;
  return 0;
}
