#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
void f(ll n,ll x,ll l){
if(n==0) return;
if(x<=pow(2,n-1)-1){
cout<<0;
f(n-1,x,l/2);
}
else{
cout<<1;
f(n-1,l-x-1,l/2);
}
}
int main(){
ll k,n;
cin>>n>>k;
f(n,k,pow(2,n));
return 0;
}