Problem: The map of Bertown can be represented as a set of intersections, numbered from to and connected by one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from one intersection to another is the number of roads that one has to traverse along the path. The shortest path from one intersection to another intersection is the path that starts in , ends in and has the minimum length among all such paths.
Polycarp lives near the intersection and works in a building near the intersection . Every day he gets from to by car. Today he has chosen the following path to his workplace: , , ..., , where , , and all other elements of this sequence are the intermediate intersections, listed in the order Polycarp arrived at them. Polycarp never arrived at the same intersection twice, so all elements of this sequence are pairwise distinct. Note that you know Polycarp's path beforehand (it is fixed), and it is not necessarily one of the shortest paths from to .
Polycarp's car has a complex navigation system installed in it. Let's describe how it works. When Polycarp starts his journey at the intersection , the system chooses some shortest path from to and shows it to Polycarp. Let's denote the next intersection in the chosen path as . If Polycarp chooses to drive along the road from to , then the navigator shows him the same shortest path (obviously, starting from as soon as he arrives at this intersection). However, if Polycarp chooses to drive to another intersection instead, the navigator rebuilds the path: as soon as Polycarp arrives at , the navigation system chooses some shortest path from to and shows it to Polycarp. The same process continues until Polycarp arrives at : if Polycarp moves along the road recommended by the system, it maintains the shortest path it has already built; but if Polycarp chooses some other path, the system rebuilds the path by the same rules.
Here is an example. Suppose the map of Bertown looks as follows, and Polycarp drives along the path (, ):
Check the picture by the link http://tk.codeforces.com/a.png
- When Polycarp starts at , the system chooses some shortest path from to . There is only one such path, it is ;
- Polycarp chooses to drive to , which is not along the path chosen by the system. When Polycarp arrives at , the navigator rebuilds the path by choosing some shortest path from to , for example, (note that it could choose );
- Polycarp chooses to drive to , which is not along the path chosen by the system. When Polycarp arrives at , the navigator rebuilds the path by choosing the only shortest path from to , which is ;
- Polycarp arrives at along the road chosen by the navigator, so the system does not have to rebuild anything.
Overall, we get rebuilds in this scenario. Note that if the system chose instead of during the second step, there would be only rebuild (since Polycarp goes along the path, so the system maintains the path during the third step).
The example shows us that the number of rebuilds can differ even if the map of Bertown and the path chosen by Polycarp stays the same. Given this information (the map and Polycarp's path), can you determine the minimum and the maximum number of rebuilds that could have happened during the journey?
Input Format: The first line contains two integers and () — the number of intersections and one-way roads in Bertown, respectively.
Then lines follow, each describing a road. Each line contains two integers and (, ) denoting a road from intersection to intersection . All roads in Bertown are pairwise distinct, which means that each ordered pair appears at most once in these lines (but if there is a road , the road can also appear).
The following line contains one integer () — the number of intersections in Polycarp's path from home to his workplace.
The last line contains integers , , ..., (, all these integers are pairwise distinct) — the intersections along Polycarp's path in the order he arrived at them. is the intersection where Polycarp lives (), and is the intersection where Polycarp's workplace is situated (). It is guaranteed that for every the road from to exists, so the path goes along the roads of Bertown.
Output Format: Print two integers: the minimum and the maximum number of rebuilds that could have happened during the journey.