#include using namespace std; long factorial(long n){ if (n<=1) return 1; return n*factorial(n-1); } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); long n,m; cin>>n>>m; if(n>=m) cout<<"0\n"; else cout<<(factorial(n))%m<<"\n"; }