n,k = map(int,input().split()) *a, = map(int,input().split()) for i in range(n): a[i] -= 1 c = 0 for i in range(n): if a[i] < 0: continue c += 1 while a[i] >= 0: ni = a[i] a[i] = -1 i = ni print("Yes" if k >= n-c and (k-n+c)%2==0 else "No")