#include <iostream>
#include <vector>
#include <cmath>
#define ull unsigned long long
using namespace std;
int n;
ull k;
int main(){
cin >> n >> k;
ull d = pow(2, n - 1);
while(n){
if(k < d){
cout << 0;
}
else{
cout << 1;
k = d * 2 - k - 1;
}
n --;
d = pow(2, n - 1);
}
return 0;
}