#include <bits/stdc++.h>
using namespace std;
const int MAXN = 55;
int n;
long long k;
int ans[MAXN];
long long Getnum(int* a, int m) {
  if (m == n) {
    int b[MAXN];
    for (int i = 1; i <= n; i++) b[i] = a[n + 1 - i];
    if (b[1] == 1)
      for (int i = 1; i <= n; i++) b[i] = 1 - b[i];
    for (int i = 1; i <= n; i++) {
      if (a[i] < b[i]) return 1;
      if (b[i] < a[i]) return 0;
    }
    return 1;
  }
  long long t1 = 0, t2 = 0;
  if (m <= n / 2) {
    long long s = 0;
    for (int i = 2; i <= m; i++) s = s * 2 + 1 - a[i];
    t1 += s << (n - 2 * m);
    long long x = (n - 2 * m) / 2;
    x = 1 << x;
    t1 += x * (x - 1) / 2 * (1 + n % 2);
    t2 = t1;
    t1 += x * (1 + n % 2);
    t2 += x;
  } else {
    long long s = 0;
    for (int i = 2; i <= n - m; i++) s = s * 2 + 1 - a[i];
    t1 += s;
    bool flag = true;
    for (int i = n - m + 1; i <= m; i++) {
      if (a[i] < a[n + 1 - i]) break;
      if (a[i] > a[n + 1 - i]) {
        flag = false;
        break;
      }
    }
    t2 = t1;
    if (flag) t1++;
    flag = true;
    for (int i = n - m + 1; i <= m; i++) {
      if (a[i] < 1 - a[n + 1 - i]) break;
      if (a[i] > 1 - a[n + 1 - i]) {
        flag = false;
        break;
      }
    }
    if (flag) t2++;
  }
  return t1 + t2;
}
int main() {
  cin >> n >> k;
  k++;
  ans[1] = 0;
  for (int i = 2; i <= n; i++) {
    ans[i] = 0;
    long long tmp = Getnum(ans, i);
    if (tmp < k) k -= tmp, ans[i] = 1;
  }
  if (k != 1 || Getnum(ans, n) != 1)
    cout << -1 << endl;
  else {
    for (int i = 1; i <= n; i++) cout << ans[i];
    cout << endl;
  }
  return 0;
}
