text: # Problem At the big break Nastya came to the school dining room.There are n pupils in the school, numbered from 1 to n.Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e.Nastya took the last place in the queue.Of course, it's a little bit sad for Nastya, but she is not going to despond because some pupils in the queue can agree to change places with some other pupils.Formally, there are some pairs u, v such that if the pupil with number u stands directly in front of the pupil with number v, Nastya can ask them and they will change places.Nastya asks you to find the maximal number of places in queue she can move forward.Input The first line contains two integers n and m (1 ≤ n ≤ 3 ⋅ 10^{5}, 0 ≤ m ≤ 5 ⋅ 10^{5}) — the number of pupils in the queue and number of pairs of pupils such that the first one agrees to change places with the second one if the first is directly in front of the second.The second line contains n integers p_1, p_2, ..., p_n — the initial arrangement of pupils in the queue, from the queue start to its end (1 ≤ p_i ≤ n, p is a permutation of integers from 1 to n).In other words, p_i is the number of the pupil who stands on the i-th position in the queue.The i-th of the following m lines contains two integers u_i, v_i (1 ≤ u_i, v_i ≤ n, u_i ≠ v_i), denoting that the pupil with number u_i agrees to change places with the pupil with number v_i if u_i is directly in front of v_i.It is guaranteed that if i ≠ j, than v_i ≠ v_j or u_i ≠ u_j.Note that it is possible that in some pairs both pupils agree to change places with each other.Nastya is the last person in the queue, i.e.the pupil with number p_n.Output Print a single integer — the number of places in queue she can move forward.Examples Input 2 1 1 2 1 2 Output 1 Input 3 3 3 1 2 1 2 3 1 3 2 Output 2 Input 5 2 3 1 5 4 2 5 2 5 4 Output 1 Note In the first example Nastya can just change places with the first pupil in the queue.