#include #include using namespace std; int main(){ int N, M; cin >> N >> M; vector dp(N); dp[0] = 0; dp[1] = 1; for (int i = 2; i < N; i++){ dp[i] = (dp[i - 2] + dp[i - 1]) % M; } cout << dp[N - 1] << endl; }