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