n,k=map(int,input().split()) d=list(map(int,input().split())) for i in range(n): d[i]-=1 c=0 for i in range(n): while d[i]!=i: j=d[i] d[i],d[j]=d[j],d[i] c+=1 if k>=c and (k-c)%2==0: print('YES') else: print('NO')