시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 24 8 7 53.846%

문제

Zenyk is given n balls with integers a1, . . . , an on them, and also k boxes. You have to put each ball in a box, and each box must have at least one ball in it. The value of a box is the bitwise AND of all integers on the balls in it.

Find the maximum total sum (regular) of all boxes and the number of ways to put balls in boxes that achieve the maximum sum. Note that the order of balls in a particular box is not important. However, all boxes are different, and all balls are also different, even if some balls have the same integer on them.

입력

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 105). The next line contains n integers a1, . . . , an (0 ≤ aj ≤ 109).

출력

Print two integers. The first integer should be the maximum total sum of all boxes. The second integer should be the number of ways to put balls in boxes modulo 109 + 7.

예제 입력 1

3 2
4 7 5

예제 출력 1

11 2

예제 입력 2

4 1
44 47 74 77

예제 출력 2

8 1

예제 입력 3

4 4
44 47 74 77

예제 출력 3

242 24