#include <bits/stdc++.h>
using namespace std;
int n;
long long dp[26][2][2];
long long need;
bool hasone = 0;
int ans[55];
inline void upd(long long &a, long long b) { a += b; }
inline long long getval(int p, int v) {
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = 1;
  for (int i = 0; i < (n + 1) / 2; i++) {
    for (int x = 0; x < 2; x++) {
      for (int y = 0; y < 2; y++) {
        if (!dp[i][x][y]) continue;
        for (int a = 0; a < 2; a++) {
          if (!i && a) continue;
          if (i <= p && a != ans[i]) continue;
          for (int b = 0; b < 2; b++) {
            if ((n - 1 - i) <= p && b != ans[n - 1 - i]) continue;
            if (i == n - 1 - i && a != b) continue;
            if (a > b && !x) continue;
            if (a > !b && !y) continue;
            upd(dp[i + 1][x | (a < b)][y | (a < !b)], dp[i][x][y]);
          }
        }
      }
    }
  }
  return dp[(n + 1) / 2][0][0] + dp[(n + 1) / 2][0][1] + dp[(n + 1) / 2][1][0] +
         dp[(n + 1) / 2][1][1] - !hasone;
}
int main() {
  cin >> n >> need;
  dp[0][0][0] = 1;
  for (int i = 0; i < (n + 1) / 2; i++) {
    for (int x = 0; x < 2; x++) {
      for (int y = 0; y < 2; y++) {
        if (!dp[i][x][y]) continue;
        for (int a = 0; a < 2; a++) {
          if (!i && a) continue;
          for (int b = 0; b < 2; b++) {
            if (i == n - 1 - i && a != b) continue;
            if (a > b && !x) continue;
            if (a > !b && !y) continue;
            upd(dp[i + 1][x | (a < b)][y | (a < !b)], dp[i][x][y]);
          }
        }
      }
    }
  }
  long long all = dp[(n + 1) / 2][0][0] + dp[(n + 1) / 2][0][1] +
                  dp[(n + 1) / 2][1][0] + dp[(n + 1) / 2][1][1];
  all--;
  if (all < need) {
    printf("-1\n");
    return 0;
  }
  for (int i = 0; i < n; i++) {
    ans[i] = 0;
    long long num = getval(i, ans[i]);
    if (num < need || (i == n - 1 && !hasone)) {
      ans[i] = 1;
      need -= num;
      hasone = 1;
    }
  }
  for (int i = 0; i < n; i++) printf("%d", ans[i]);
  return 0;
}
