1229: 历史

Memory Limit:128 MB Time Limit:2.000 S
Judge Style:Text Compare Creator:
Submit:1 Solved:1

Description

Input

Output

Sample Input Copy

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

Sample Output Copy

6
7
9
10

HINT

Source/Category