#include <bits/stdc++.h>
using namespace std;
const int N = 60;
int n, a[N];
long long k, dp[N][2][2];
long long dfs(int p, int x, int y) {
  if (p > n - p + 1) return 1;
  if (~dp[p][x][y]) return dp[p][x][y];
  long long res = 0;
  for (int i = (0); i <= (1); i++)
    if (a[p] != (i ^ 1))
      for (int j = (0); j <= (1); j++)
        if (a[n - p + 1] != (j ^ 1)) {
          if (x && i > j || y && i > !j || p == n - p + 1 && i != j) continue;
          res += dfs(p + 1, x && i == j, y && i != j);
        }
  dp[p][x][y] = res;
  return res;
}
int main() {
  scanf("%d%lld", &n, &k);
  k++;
  memset(a, -1, sizeof(a));
  memset(dp, -1, sizeof(dp));
  a[1] = 0;
  if (dfs(1, 1, 1) < k) return puts("-1"), 0;
  for (int i = (2); i <= (n); i++) {
    a[i] = 0;
    memset(dp, -1, sizeof(dp));
    long long tmp = dfs(1, 1, 1);
    if (tmp < k) k -= tmp, a[i] = 1;
  }
  for (int i = (1); i <= (n); i++) putchar(a[i] + '0');
  return 0;
}
