Problem 28563 --历史

28563: 历史

Time Limit: 2 Sec  Memory Limit: 128 MB
Submit: 1  Solved: 1
[Submit][Status][Web Board][Creator:][下载FPS0元][添加到购物车][下载测试数据0元][65430kb]

Description

Input

Output

Sample Input

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

Sample Output

6
7
9
10

HINT

Source

[Submit][Status]