Hide

Problem I
Rhythm Hell

After doom-scrolling YouTube Shorts for several hours, Harry got tired and started watching regular YouTube videos instead. He stumbled upon this video, which gave him a problem idea.

Your task is to solve that problem. If it’s not obvious what the problem is, listen to the video for a while, and it should become clear.

Input

The first line of contains two integers $N$, $M$ ($2 \leq N \leq 64$, $0 \leq M \leq 64$).

The second line contains $N$ space seperated integers $t_1, t_2, \dots , t_N$, ($1 \leq t_i \leq 10^9$).

Output

Print a single integer: the answer to the problem.

Sample Input 1 Sample Output 1
11 0
4 4 8 8 4 4 4 4 12 12 12
2
Sample Input 2 Sample Output 2
10 0
3 1 4 1 5 9 2 6 5 3
0
Sample Input 3 Sample Output 3
8 0
1 2 3 4 1 2 3 4
4
Sample Input 4 Sample Output 4
5 1
1 2 3 4 5
1
Sample Input 5 Sample Output 5
5 1
1 2 5 4 5
2
Sample Input 6 Sample Output 6
5 2
1 2 3 4 5
2
Sample Input 7 Sample Output 7
21 23
1 1 2 3 5 7 11 15 22 30 42 56 77 101 135 176 231 297 385 490 627
10
Sample Input 8 Sample Output 8
3 1
4 8 4
1
Sample Input 9 Sample Output 9
7 1
3 7 3 9 3 7 3
2

Please log in to submit a solution to this problem

Log in