Sakurako and a Falling Tree #367

Sakurako and a Falling Tree

When there is a cat and a Christmas tree....

Sakurako is afraid that Chefir will knock over her beautiful Christmas tree and break all decorations on it. In order to prevent this, she will select some vertices of the tree and reinforce them.

The tree can be represented as a graph with nodes labeled as numbers from to , in which every node except for the root node (marked as node ) has a parent node with a label that has a value smaller than its own.

The decoration will not break if and only if it is connected with at least one another decoration. A pair of decorations is considered to be connected if all nodes on a path from to are reinforced. A path from to is a list of nodes that would provide the fastest passage between them if you could only move from a node to its parent or child nodes.

Your task is to find the minimum number of vertices that need to be reinforced so that none of Sakurako's decorations break.

Input

The first line contains two integers and (2\le m\le n\le 10^6).

The second line contains n-1 numbers p_2, p_3, \dots, p_n (2\le i\le n) — the node to which the -th node is connected.

The third line contains numbers a_1, a_2, \dots, a_m (1 \leq a_i \leq n) — different positions of each of the decorations.

Output

Output one number — the minimal amount of vertices that need to be reinforced in order for every decoration to remain intact.

Examples

Example 1

Loading
Loading

Note

In the first test case, we will be choosing nodes 1,2,3,4,8,9,10,11. The decorations would be connected in the following way: 1\iff 2, 1\iff 3, 4\iff 5, 5\iff 6.

Scoring

In this problem, there are conditional blocks. If your solution works correctly for certain constraints, it will receive a certain number of points. Note that testing is going test by test, but not by blocks.

  1. ( points): n \leq 15;

  2. ( points): m=2;

  3. ( points): n\le 10^4;

  4. ( points): without additional constraints.