import java.util.Scanner // fun _Do() { val N = scan.nextInt() val M = scan.nextInt() var fib = 0L var fprev = 0L var f = 1L for(i in 1 until N) { when (i) { 1 -> 0 else -> { fib = fprev+f fprev = f f = fib } } } println( fib % M ) } var scan = Scanner(System.`in`) fun main( argv : Array ) { _Do() }