5 3
2 1 3 1 0
1 1 0 2 0
0 3
1 4
2 3
