#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x * neg;
}
inline void print(long long x) {
  if (x < 0) {
    putchar('-');
    print(abs(x));
    return;
  }
  if (x <= 9)
    putchar(x + '0');
  else {
    print(x / 10);
    putchar(x % 10 + '0');
  }
}
inline long long qpow(long long x, long long e, long long _MOD) {
  long long ans = 1;
  while (e) {
    if (e & 1) ans = ans * x % _MOD;
    x = x * x % _MOD;
    e >>= 1;
  }
  return ans;
}
long long n = read(), k = read(), a[55];
long long dp[55][2][2];
inline long long dfs(long long l, long long r, bool lim1, bool lim2) {
  if (~dp[l][lim1][lim2]) return dp[l][lim1][lim2];
  if (l + 1 > r - 1) return 1;
  long long ans = 0;
  dp[l][lim1][lim2] = 0;
  for (long long k1 = 0; k1 < 2; k1++) {
    if ((a[l + 1] == k1 || a[l + 1] == -1))
      for (long long k2 = 0; k2 < 2; k2++) {
        if (l + 1 == r - 1 && k1 != k2) continue;
        if ((a[r - 1] == k2 || a[r - 1] == -1)) {
          if ((!lim1 || (k1 <= k2)) && (!lim2 || (k1 <= 1 - k2))) {
            ans += dfs(l + 1, r - 1, lim1 & (k1 == k2), lim2 & (k1 != k2));
          }
        }
      }
  }
  dp[l][lim1][lim2] = ans;
  return ans;
}
signed main() {
  memset(a, -1, sizeof(a));
  memset(dp, -1, sizeof(dp));
  k++;
  if (dfs(0, n + 1, 1, 1) < k) {
    return puts("-1"), 0;
  }
  for (long long i = 1; i <= n; i++) {
    memset(dp, -1, sizeof(dp));
    a[i] = 0;
    long long sum = dfs(0, n + 1, 1, 1);
    if (sum < k) {
      k -= sum;
      a[i] = 1;
    }
  }
  for (long long i = 1; i <= n; i++) putchar(a[i] ^ 48);
  return 0;
}
