#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long t;
int a[51], b[51];
int check() {
  if (b[1] == 0) {
    for (int i = 1; i <= n / 2; i++)
      if (a[n / 2 + 1 - i] != b[i]) return a[n / 2 + 1 - i] < b[i] ? -1 : 1;
    return 0;
  } else {
    for (int i = 1; i <= n / 2; i++)
      if (a[n / 2 + 1 - i] != (b[i] ^ 1))
        return a[n / 2 + 1 - i] < (b[i] ^ 1) ? -1 : 1;
    return 0;
  }
}
void print(long long t1, long long t2) {
  t = (1 << (n / 2));
  long long p = t1;
  int z = 0;
  while (p > 0) {
    a[++z] = p % 2;
    p /= 2;
  }
  for (int i = n / 2; i >= 1; i--) printf("%d", a[i]);
  for (long long i = 1; i < t; i++) {
    b[1]++;
    int k = 1;
    while (b[k] > 1) {
      b[k] -= 2;
      k++;
      b[k]++;
    }
    if (check() <= 0) {
      m--;
      if (m == 0) {
        if (n % 2 == 1) printf("0");
        for (int j = n / 2; j >= 1; j--) printf("%d", b[j]);
        printf("\n");
        return;
      }
    }
  }
  memset(b, 0, sizeof(b));
  for (long long i = 0; i < t; i++) {
    int k = check();
    if (k == -1 || (k == 0 && b[1] == 0)) {
      m--;
      if (m == 0) {
        if (n % 2 == 1) printf("1");
        for (int j = n / 2; j >= 1; j--) printf("%d", b[j]);
        printf("\n");
        return;
      }
    }
    b[1]++;
    k = 1;
    while (b[k] > 1) {
      b[k] -= 2;
      k++;
      b[k]++;
    }
  }
}
int main() {
  scanf("%I64d%I64d", &n, &m);
  t = (1 << (n / 2));
  if (n % 2 == 0) {
    if (m < t) {
      print(0, m);
      return 0;
    }
    m -= t - 1;
    for (long long i = 1; i < t / 2; i++) {
      if (m <= 2 * (t / 2 - i)) {
        print(i, m);
        return 0;
      }
      m -= 2 * (t / 2 - i);
    }
  } else {
    if (m < t * 2 - 1) {
      print(0, m);
      return 0;
    }
    m -= 2 * t - 2;
    for (long long i = 1; i < t / 2; i++) {
      if (m <= 4 * (t / 2 - i) - 1) {
        print(i, m);
        return 0;
      }
      m -= 4 * (t / 2 - i) - 1;
    }
  }
  printf("-1\n");
  return 0;
}
