#import pdb; pdb.set_trace() import sys import math def main(): (n, k) = map(int, raw_input().split()) d = map(int, raw_input().split()) count = 0 j = 0 while j < n: tmpd = d[j] if tmpd - 1 != j: tmpe = d[tmpd - 1] d[tmpd - 1] = tmpd d[j] = tmpe count += 1 else: j += 1 if k > count: if (k - count) % 2 == 0: print "YES" else: print "NO" elif k == count: print "YES" else: print "NO" if __name__ == '__main__': main()