Codeforces Round 360 (Div. 2)


A. Opponents
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
10
00
Output
2
Input
4 1
0100
Output
1
Input
4 5
1101
1111
0110
1011
1111
Output
2
----------------------------------------------------------------------------------------------------
B. Lovely Palindromes
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
Output
11
Input
10
Output
1001
----------------------------------------------------------------------------------------------------
C. NP-Hard Problem
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 2
1 2
2 3
Output
1
2 
2
1 3 
Input
3 3
1 2
2 3
1 3
Output
-1
----------------------------------------------------------------------------------------------------
D. Remainders Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5
2 3 5 12
Output
Yes
Input
2 7
2 3
Output
No
----------------------------------------------------------------------------------------------------
E. The Values You Can Make
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 18
5 6 1 10 12 2
Output
16
0 1 2 3 5 6 7 8 10 11 12 13 15 16 17 18 
Input
3 50
25 25 50
Output
3
0 25 50 
----------------------------------------------------------------------------------------------------
