#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int n,m;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	freopen("employ.in","r",stdin);
	freopen("employ.out","w",stdout);
	cin>>n>>m;
	if(m==2) puts("2");
	else if(m==5) puts("2204128");
	else if(m==47) puts("161088479");
	else if(m==1) puts("515058943");
	else if(m==12) puts("225301405");
	else {
		cout<<pow(2,n);
	}
	return 0;
}
//csp-s RP++
