时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
Bobo has generated a list of sequences:
where A+B means the concatenation of two sequences A and B.
For a given sequence

, let f(i) be the Hamming distance between

and

(
)
. :Bobo would like to find the minimum value of f(i) and the sum of f(i) modulo
)
.
Note that the Hamming distance between two sequences of equal length is the number of positions at which the corresponding elements are different.
输入描述:
The input consists of several test cases terminated by end-of-file.
The first line contains two integers n and m.
The second line contains n integers
.
* 
* )
* 
* The sum of n does not exceed
.
输出描述:
For each test case, output two integers denoting the minimum value of f(i) and the sum of f(i) modulo
.
示例1
输入
复制
3 3
1 2 3
3 3
1 1 1
3 3
1 2 1