#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T a, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << a;
}
static void print(long long a, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << a << "LL";
}
static void print(string a, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << '"' << a << '"';
}
template <typename T, typename W>
void print(pair<T, W> P, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << "(";
  print(P.first);
  cerr << ",";
  print(P.second);
  cerr << ")";
}
template <typename T>
void print(vector<T> a, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << "{";
  for (int i = 0; i != a.size(); i++) {
    if (i != 0) cerr << ", ";
    print(a[i]);
  }
  cerr << "}" << endl;
}
void printBits(unsigned int x, int end = 32, int start = 0) {
  for (int i = end - 1; i >= start; i--)
    if (x & (1 << i))
      cout << 1 << " ";
    else
      cout << 0 << " ";
}
template <typename T>
void printEndl(T x, string name = "") {
  print(x, name);
  cerr << endl;
}
template <typename T>
vector<T> tokenize(string s, string delim) {
  int i = 0, j = 0;
  vector<T> ret;
  for (; i < s.size(); ++i) {
    j = s.find_first_of(delim, i);
    if (j == -1) j = s.size();
    if (j > i) {
      stringstream in(s.substr(i, j - i));
      T temp;
      in >> temp;
      ret.push_back(temp);
    }
    i = j;
  }
  return ret;
}
template <typename T>
void gcd(T a, T b) {
  return a ? gcd(b % a, a) : b;
}
int bitCount(int x) { return __builtin_popcount(x); }
long long int two(int x) { return (1LL << x); }
bool test(long long int mask, int x) { return (mask & two(x)) > 0; }
template <typename T>
bool checkMax(T& ret, T& cur) {
  if (ret < cur) {
    ret = cur;
    return true;
  }
  return false;
}
template <typename T>
bool checkMin(T& ret, T& cur) {
  if (ret > cur) {
    ret = cur;
    return true;
  }
  return false;
}
const char eof = -123;
int readInt() {
  int x;
  if (scanf("%d", &x) != 1) return eof;
  return x;
}
char readChar() {
  char c;
  if (scanf("%c", &c) != 1) return eof;
  return c;
}
long long int readLL() {
  long long int x;
  if (cin >> x) return x;
  return eof;
}
double readDouble() {
  double f;
  if (scanf("%lf", &f) == 1) return f;
  return eof;
}
long long int memo[51][2][2][2];
int n;
string s;
int take[52][2][2][2];
long long int doit(int x, int y, int rev, int flip, int revAndFlip,
                   long long int K) {
  if (x < 0) return (rev || flip || revAndFlip) ? 0 : 1;
  long long int& ret = memo[x][rev][flip][revAndFlip];
  if (ret != -1) return ret;
  ret = 0;
  for (int d = 0; d <= 1; ++d)
    if (y >= s.size() || s[y] == d + '0')
      for (int c = 0; c <= 1; ++c)
        if (x >= s.size() || s[x] == c + '0')
          if (y != x || d == c) {
            int newRev = (rev && !(c < d)) || (d < c);
            int newFlip = (flip && !(c == 0)) || (c == 1);
            int newRevAndFlip = (revAndFlip && !(c < (1 - d))) || (1 - d < c);
            long long int cur =
                doit(x - 1, y + 1, newRev, newFlip, newRevAndFlip, K - ret);
            take[y][rev][flip][revAndFlip] = d;
            ret += cur;
            if (ret > K) {
              return ret;
            }
          }
  return ret;
}
long long int get(long long int K) {
  memset(memo, -1, sizeof(memo));
  return doit((n - 1) / 2, n - 1 - (n - 1) / 2, 0, 0, 0, K);
}
int main() {
  memset(memo, -1, sizeof(memo));
  n = readInt();
  long long int K = readLL();
  long long int ret = 0;
  for (int i = 0; i < n; ++i) {
    s += '0';
    bool found = false;
    for (int j = 0; j <= 1; ++j) {
      s[i] = (char)(j + '0');
      long long int cur = get(K - ret);
      if (ret + cur > K) {
        found = true;
        break;
      } else
        ret += cur;
    }
    if (!found) {
      ret = -1;
      break;
    }
  }
  if (ret == -1)
    cout << -1 << endl;
  else {
    cout << s << endl;
  }
}
