Distinct Substrings
题号:NC53382
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
Special Judge, 64bit IO Format: %lld

题目描述

For a string , Bobo denotes the number of its distinct substrings as . He also defines defines for character c.
Given a string and m, find the value of
.
Note that denotes the bitwise exclusive-or (XOR).

输入描述:

The input consists of several test cases and is terminated by end-of-file.
The first line of each test case contains two integers n and m.
The second line contains n integers .

*
*
* The sum of n, and the sum of m do not exceed .

输出描述:

For each test case, print an integer which denotes the result.
示例1

输入

复制
3 2
1 1 2
2 3
1 2
1 1000000
1

输出

复制
18
69
317072014

备注:

For the second test case, h(1) = h(2) = 2, h(3) = 3.