There is a tree, it's root is point 1.Then Job adds some edges, so for each subtree, he want to know the number of new edges which are full contained by this subtree. The means of full contained is that the edge's two endpoints u and v are both in the subtree.
Input contains multiple test cases. Each test case starts with two numbers n(the number of points) and m(the number of edges that are added) (2<=n<=10^6,1<=m<=10^5).
The next line contains n-1 integer,a[1],a[2]...a[n-1]. a[i] means there is an edge between i+1 and a[i] (1 <= a[i] <= i)
The next m lines contain two integer numbers each which means the endpoint of edge that is added. (1 <= a, b <= n && a != b)
For each text case, output n numbers, the i'th integer is the number of full contained edges of subtree with root i
2 1 1 1 2 6 4 1 1 2 2 3 4 5 2 4 3 5 3 6
1 0 4 2 1 0 0 0