#include #include "bits/stdc++.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef long long ll; const int INF = 1e8; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) using namespace std; typedef pair P; int n, m; ll memo[500010]; ll fib( ll n){ if(n ==1){ return 0; } if(n ==2){ return 1; } if(memo[n] !=0){ return memo[n]; } return memo[n] = (fib(n-1)+fib(n-2))%m; } int main() { cin>>n>>m; cout<