n,k,*d=$<.read.split.map &:to_i i,z=0,[] n.times{ m=i+1 next(i=m)if d[i]==m j=d.index m next(i=j+1)if z[j]==0 z[i]=0 i=j } c=z.count 0 puts c<=k&&(k-c)&1==0 ? :YES : :NO