#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, dp[55][2][2], x, y, ans[55];
long long dfs(long long l, long long r, long long lim1, long long lim2) {
  if (l > r) return 1;
  if (dp[l][lim1][lim2] != -1) return dp[l][lim1][lim2];
  dp[l][lim1][lim2] = 0;
  int i, j;
  for (i = 0; i < 2; i++)
    for (j = 0; j < 2; j++) {
      if (l == r && i != j) continue;
      if (ans[l] > -1 && ans[l] != i) continue;
      if (ans[r] > -1 && ans[r] != j) continue;
      if (i > j && !lim1) continue;
      if (i > 1 - j && !lim2) continue;
      dp[l][lim1][lim2] += dfs(l + 1, r - 1, lim1 || i < j, lim2 || i < 1 - j);
    }
  return dp[l][lim1][lim2];
}
int main() {
  cin >> n >> m;
  memset(dp, -1, sizeof(dp));
  memset(ans, -1, sizeof(ans));
  if (dfs(1, n, 0, 0) <= m) {
    puts("-1");
    return 0;
  }
  x = 1;
  y = 1;
  for (i = 1; i <= n; i++) {
    ans[i] = 0;
    if (i == 1) continue;
    memset(dp, -1, sizeof(dp));
    long long t = dfs(1, n, 0, 0);
    if (t <= m) {
      m -= t;
      ans[i] = 1;
    }
  }
  for (i = 1; i <= n; i++) cout << ans[i];
  return 0;
}
