QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB

# 5011. Course Selection

Statistics

Sample Input

6 3
1
2
3
1
1
1
1 2 3 4 5
1 2 3 4 5
1 2 3 4 6

Sample Output

9
1 2 3 4 5
2 3
3 6