n,k,*d=$<.read.split.map &:to_i c=0 n.times{|i|(c+=1;d[o],o=p,d[o]-1)while d[i]} puts c>k||c%2==k%2?:NO:'YES'