#include <iostream>
#include <cstdlib>
#include <fstream>
#define max(a,b) a<b?b:a
#define uuu 100000000
using namespace std;
typedef long ar[100];
ar f[513][513]={0};
void count(long *c,long* a,long* b){
c[0]=a[0]>b[0]?a[0]:b[0];
for(long i=1;i<=c[0];i++){
c[i]=a[i]+b[i];
}
for(long i=1;i<=c[0];i++){
c[i+1]+=(c[i]/uuu);
c[i]%=uuu;
}
c[0]=c[c[0]+1]?c[0]+1:c[0];
}
void pluss(long* a,long* b){
a[0]=a[0]>b[0]?a[0]:b[0];
for(long i=1;i<=a[0];i++){
a[i]+=b[i];
a[i+1]+=(a[i]/uuu);
a[i]%=uuu;
}
a[0]=a[a[0]+1]?a[0]+1:a[0];
}
int main(int argc,char** argv){
ifstream fin("digital.in");
ofstream fout("digital.ans");
long k,w;
cin >>k>>w;
long n=w/k,m=(1<<k)-1;
long t;
t=(1<<w%k)-1;
for(long i=0;i<=m;i++){f[1][i][1]=1;f[1][i][0]=1;}
for(long i=2;i<=n+1;i++)
for(long j=m-i+1;j>=1;j--){
count(f[i][j],f[i-1][j+1],f[i][j+1]);
}
long ans[200]={0};
for(long i=2;i<=n;i++)
for(long j=1;j<=m;j++)
pluss(ans,f[i][j]);
if(w%k!=0)
for(long i=1;i<=t;i++)
pluss(ans,f[n+1][i]);
printf("%d",ans[ans[0]]);
for(long i=ans[0]-1;i>=1;i--){
long temp=ans[i];
while(temp<(uuu/10)){
printf("0");;
temp*=10;
}
printf("%d",ans[i]);
}
cout <<'\n';
fin.close();
fout.close();
return 0;
}