#include <bits/stdc++.h>
using namespace std;
const int maxN = 55;
int n;
long long k, ans;
long long f[maxN][2][2];
long long calc(int pos) {
  memset(f, 0, sizeof(f));
  f[0][1][1] = 1;
  int k;
  for (int i = 0; i <= n - 1; ++i) {
    if (i + 1 > n - i) {
      k = i;
      break;
    }
    for (int a = 0; a <= 1; ++a)
      for (int b = 0; b <= 1; ++b)
        if (f[i][a][b]) {
          for (int x = 0; x <= 1; ++x)
            if (i + 1 > pos || x == (((ans) >> ((i + 1) - 1)) & 1))
              for (int y = 0; y <= 1; ++y)
                if ((n - i != i + 1 || y == x) &&
                    (n - i > pos || y == (((ans) >> ((n - i) - 1)) & 1))) {
                  int z = 1 - y;
                  if (a && y < x) continue;
                  if (b && z < x) continue;
                  f[i + 1][a & bool(y == x)][b & bool(z == x)] += f[i][a][b];
                }
          cerr << i << ' ' << a << ' ' << b << ' ' << f[i][a][b] << endl;
        }
  }
  long long s = 0;
  for (int i = 0; i <= 1; ++i)
    for (int j = 0; j <= 1; ++j) s += f[k][i][j];
  return s;
}
int main() {
  cin >> n >> k;
  ++k;
  if (calc(1) < k) {
    puts("-1");
    return 0;
  }
  for (int i = 2; i <= n; ++i) {
    long long tmp = calc(i);
    if (k > tmp) k -= tmp, ans |= 1LL << (i - 1);
  }
  for (int i = 1; i <= n; ++i) printf("%d", (ans >> (i - 1)) & 1);
  puts("");
  return 0;
}
