题号:NC213131
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
Bobo has an integer x and two n arrays

,

. He makes an

matrix M
where

Find the determinant of the matrix M modulo
)
.
输入描述:
The input consists of several test cases terminated by end-of-file.
The first line of each test case contains two integers n and x. The second line contains n integers
. The third line contains n integers
.
* 
* 
* The sum of n does not exceed
.
输出描述:
For each test case, print an integer which denotes the result.
示例1
输入
复制
2 1
0 0
0 0
2 1
1000000000 1000000000
1000000000 1000000000
3 2
2 3 3
2 3 3