The cat

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