对于50%数据,A<=20,Q<=100.
对于全部数据,A<=2*10^9,Q<=10^8.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = 40000 + 20;
const int moder = 1e9 + 7;
const int K = 256;
ll mod_pow(ll x,ll n,ll mod)
{
ll res = 1;
while(n > 0)
{
if(n & 1) res = (res * x) % mod;
x = (x * x) % mod;
n >>= 1;
}
return res;
}
int main()
{
ll b,p,k;
scanf("%lld%lld",&p,&k);
cout << mod_pow(2,p,k);
return 0;
}