Preparando MOJI
Little Petya likes permutations a lot. Recently his mom has presented him permutation q1, q2, ..., qn of length n.
A permutation a of length n is a sequence of integers a1, a2, ..., an (1 ≤ ai ≤ n), all integers there are distinct.
There is only one thing Petya likes more than permutations: playing with little Masha. As it turns out, Masha also has a permutation of length n. Petya decided to get the same permutation, whatever the cost may be. For that, he devised a game with the following rules:
We know that after the k-th move the board contained Masha's permutation s1, s2, ..., sn. Besides, we know that throughout the game process Masha's permutation never occurred on the board before the k-th move. Note that the game has exactly k moves, that is, throughout the game the coin was tossed exactly k times.
Your task is to determine whether the described situation is possible or else state that Petya was mistaken somewhere. See samples and notes to them for a better understanding.
The first line contains two integers n and k (1 ≤ n, k ≤ 100). The second line contains n space-separated integers q1, q2, ..., qn (1 ≤ qi ≤ n) — the permutation that Petya's got as a present. The third line contains Masha's permutation s, in the similar format.
It is guaranteed that the given sequences q and s are correct permutations.
If the situation that is described in the statement is possible, print "YES" (without the quotes), otherwise print "NO" (without the quotes).
4 1
2 3 4 1
1 2 3 4
NO
4 1
4 3 1 2
3 4 2 1
YES
4 3
4 3 1 2
3 4 2 1
YES
4 2
4 3 1 2
2 1 4 3
YES
4 1
4 3 1 2
2 1 4 3
NO
In the first sample Masha's permutation coincides with the permutation that was written on the board before the beginning of the game. Consequently, that violates the condition that Masha's permutation never occurred on the board before k moves were performed.
In the second sample the described situation is possible, in case if after we toss a coin, we get tails.
In the third sample the possible coin tossing sequence is: heads-tails-tails.
In the fourth sample the possible coin tossing sequence is: heads-heads.