#include <bits/stdc++.h>
using namespace std;
long long N, K;
long long dp[51][2][2];
long long ss[51];
long long dfs(long long now, long long a, long long b) {
  long long tmp, x, y;
  long long& get = dp[now][a][b];
  if (get >= 0) return get;
  get = 0;
  if (now > (N + 1) / 2) return get = 1;
  for (x = 0; x <= 1; x++)
    for (y = 0; y <= 1; y++) {
      if (now == N - now + 1 && x != y) continue;
      if (ss[now] >= 0 && x != ss[now]) continue;
      if (ss[N - now + 1] >= 0 && y != ss[N - now + 1]) continue;
      if (a == 0 && x > y) continue;
      if (b == 0 && x + y > 1) continue;
      get += dfs(now + 1, a | (x < y), b | (x + y < 1));
    }
  return get;
}
int main() {
  long long i, j, tmp;
  scanf("%I64d %I64d", &N, &K);
  memset(ss, -1, sizeof(ss));
  memset(dp, -1, sizeof(dp));
  ss[1] = 0, K++;
  if ((tmp = dfs(1, 0, 0)) < K) {
    printf("-1\n");
    return 0;
  }
  for (i = 2; i <= N; i++) {
    ss[i] = 0;
    memset(dp, -1, sizeof(dp));
    if ((tmp = dfs(1, 0, 0)) >= K)
      ;
    else
      ss[i] = 1, K -= tmp;
  }
  for (i = 1; i <= N; i++) printf("%I64d", ss[i]);
  return 0;
}
