#include using namespace std; typedef unsigned long long int ull; map memo[210]; ull solve(int N,int K){ if (memo[N].find(K)!=memo[N].end()){ return memo[N][K]; } if (N==1){ if (K==0){ return 0ull; } else{ return 1ull; } } ull res=solve(N-1,K)+solve(N-1,K/N); memo[N][K]=res; return res; } int main(void){ int N,K; cin>>N>>K; cout<<((solve(N,K)-1ull)*2ull)+1ull<