#include int main(void) { int n, m, i; unsigned int f1 = 0, f2 = 1, fb; scanf("%d %d", &n, &m); for (i = 3; i <= n; i++) { fb = (f1 + f2) % m; f1 = f2; f2 = fb; } printf("%u\n", fb); return 0; }