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