#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n;
long long k;
int a[100];
long long dp[100][2][2];
long long dfs(int pos, int x, int y) {
  if (pos < n - pos + 1) return 1;
  if (dp[pos][x][y] != -1) return dp[pos][x][y];
  long long ans = 0;
  for (int i = 0; i <= 1; i++)
    if (a[n - pos + 1] == -1 || a[n - pos + 1] == i)
      for (int j = 0; j <= 1; j++)
        if (a[pos] == -1 || a[pos] == j) {
          if (x == 1) {
            if (i > j) continue;
          }
          if (y == 1) {
            if (i > !j) continue;
          }
          if (pos == n - pos + 1)
            if (i != j) continue;
          ans += dfs(pos - 1, x && (i == j), y && (i != j));
        }
  return dp[pos][x][y] = ans;
}
int main() {
  cin >> n >> k;
  k++;
  memset(a, -1, sizeof(a));
  memset(dp, -1, sizeof(dp));
  a[1] = 0;
  if (dfs(n, 1, 1) < k) {
    cout << -1;
  } else {
    for (int i = 1; i <= n; i++) {
      a[i] = 0;
      memset(dp, -1, sizeof(dp));
      long long t = dfs(n, 1, 1);
      if (k > t) {
        a[i] = 1;
        k -= t;
      }
    }
    for (int i = 1; i <= n; i++) cout << a[i];
  }
  return 0;
}
