#include <bits/stdc++.h>
using namespace std;
long long i, j, k, l, r, m, s, t, n, a[11236], b[123456], z, c[168456],
    zam[17456], za[1234];
bool p[40000000];
long long xx, yy, x, y;
int main() {
  cin >> n >> k;
  if (n == 2) {
    if (k == 1)
      cout << "01";
    else
      cout << -1;
    return 0;
  }
  if (n == 3) {
    if (k == 1)
      cout << "001";
    else if (k == 2)
      cout << "010";
    else
      cout << -1;
    return 0;
  }
  k++;
  if (n % 2 == 0) {
    m = n / 2;
    l = 1;
    for (i = 0; i < m; i++) l = l * 2;
    if (k > l / 2 * (l / 2 + 1)) {
      cout << -1;
      return 0;
    }
    x = l - 1;
    while (l < k) {
      k -= l;
      l -= 2;
      r = t;
      s = 0;
      for (i = 0; i < m; i++) {
        s = s * 2 + r % 2;
        r = r / 2;
      }
      p[x - s] = 1;
      p[s] = 1;
      t++;
    }
    j = t;
    for (i = 0; i < m; i++) {
      a[i] = t % 2;
      t /= 2;
    }
    for (i = m - 1; i >= 0; i--) cout << a[i];
    t = 0;
    while (k > 0) {
      if (p[t] == 0) {
        k--;
      }
      if (k == 0) break;
      t++;
    }
    for (i = 0; i < m; i++) {
      a[i] = t % 2;
      t /= 2;
    }
    for (i = m - 1; i >= 0; i--) cout << a[i];
  } else {
    long long ss = (1 << n) - 1;
    m = n / 2;
    l = 1;
    for (i = 0; i <= m; i++) l = l * 2;
    if (k > l * (l + 2) / 8) {
      cout << -1;
      return 0;
    }
    y = l / 2;
    z = y - 1;
    l--;
    x = l;
    t = 0;
    while (l < k) {
      k -= l;
      l -= 4;
      r = t;
      s = 0;
      for (i = 0; i < m; i++) {
        s = s * 2 + r % 2;
        r = r / 2;
      }
      p[z - s] = 1;
      p[s] = 1;
      p[z - s + y] = 1;
      p[s + y] = 1;
      t++;
    }
    j = t;
    r = t;
    s = 0;
    for (i = 0; i < m; i++) {
      s = s * 2 + r % 2;
      r = r / 2;
    }
    s = z - s;
    for (i = 0; i < m; i++) {
      a[i] = t % 2;
      t /= 2;
    }
    for (i = m - 1; i >= 0; i--) cout << a[i];
    t = 0;
    while (k > 0) {
      if (p[t] == 0) {
        if (t == s) {
          p[t + y] = 1;
        }
        k--;
      }
      if (k == 0) break;
      t++;
    }
    for (i = 0; i <= m; i++) {
      a[i] = t % 2;
      t /= 2;
    }
    for (i = m; i >= 0; i--) cout << a[i];
  }
  return 0;
}
