#include <bits/stdc++.h>
void Get(int &T) {
  char C;
  bool F = 0;
  for (; C = getchar(), C < '0' || C > '9';)
    if (C == '-') F = 1;
  for (T = C - '0'; C = getchar(), C >= '0' && C <= '9'; T = T * 10 + C - '0')
    ;
  F && (T = -T);
}
void Get(long long &T) {
  char C;
  bool F = 0;
  for (; C = getchar(), C < '0' || C > '9';)
    if (C == '-') F = 1;
  for (T = C - '0'; C = getchar(), C >= '0' && C <= '9'; T = T * 10 + C - '0')
    ;
  F && (T = -T);
}
int N;
long long K;
void Init() {
  Get(N);
  Get(K);
}
int M;
long long F[1005][5][5];
int A[1005];
long long GetAns() {
  memset(F, 0, sizeof F);
  F[M][0][0] = F[M][0][1] = F[M][1][0] = F[M][1][1] = 1;
  for (int L = M - 1; L >= 2; L--) {
    int R = N - L + 1;
    if (A[L] != 1 && A[R] != 1) {
      F[L][0][0] += F[L + 1][0][0];
      F[L][1][0] += F[L + 1][1][0];
      F[L][0][1] += F[L + 1][0][1];
      F[L][1][1] += F[L + 1][0][1];
    }
    if (L != R && A[L] != 1 && A[R] != 0) {
      F[L][0][0] += F[L + 1][0][0];
      F[L][1][0] += F[L + 1][0][0];
      F[L][0][1] += F[L + 1][0][1];
      F[L][1][1] += F[L + 1][1][1];
    }
    if (L != R && A[L] != 0 && A[R] != 1) {
      F[L][0][0] += F[L + 1][0][0];
      F[L][0][1] += F[L + 1][0][1];
      F[L][1][1] += F[L + 1][1][1];
    }
    if (A[L] != 0 && A[R] != 0) {
      F[L][0][0] += F[L + 1][0][0];
      F[L][1][0] += F[L + 1][1][0];
      F[L][0][1] += F[L + 1][0][1];
    }
  }
  long long Ans = 0;
  if (A[N] != 1) Ans += F[2][1][0];
  if (A[N] != 0) Ans += F[2][1][1];
  return Ans;
}
void Work() {
  M = ((N + 1) >> 1) + 1;
  for (int i = 1; i <= N; i++) A[i] = -1;
  A[1] = 0;
  if (GetAns() <= K) {
    puts("-1");
    exit(0);
  }
  for (int i = 2; i <= N; i++) {
    A[i] = 0;
    long long Ans = GetAns();
    if (Ans <= K) {
      K -= Ans;
      A[i] = 1;
    }
  }
}
void Output() {
  for (int i = 1; i <= N; i++) printf("%d", A[i]);
  puts("");
}
int main() {
  Init();
  Work();
  Output();
  return 0;
}
