#include <bits/stdc++.h>
using namespace std;
const int N = 67;
long long dp[N][2][2], K, res;
int n, m, i, j, a[N];
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 res = 0;
  for (int i = 0; i <= 1; ++i)
    if (a[pos] == -1 || a[pos] == i)
      for (int j = 0; j <= 1; ++j)
        if (a[n - pos + 1] == -1 || a[n - pos + 1] == j) {
          if (x && i > j || y && i > !j || pos == n - pos + 1 && i != j)
            continue;
          res += dfs(pos - 1, x && i == j, y && i == !j);
        }
  return dp[pos][x][y] = res;
}
int main() {
  memset(a, -1, sizeof(a));
  memset(dp, -1, sizeof(dp));
  scanf("%d%lld", &n, &K);
  ++K;
  a[n] = 0;
  if (dfs(n, 1, 1) < K)
    puts("-1");
  else {
    for (i = n - 1; i >= 1; --i) {
      memset(dp, -1, sizeof(dp));
      a[i] = 0;
      res = dfs(n, 1, 1);
      if (res < K) K -= res, a[i] = 1;
    }
    for (i = n; i >= 1; --i) printf("%d", a[i]);
    puts("");
  }
}
