n, k = map(int, raw_input().split()) a = map(int, raw_input().split()) ct = 0 for i in range(len(a)): if i != a[i] - 1: ct += 1 if ct / 2 == k: print "YES" elif ct == 0 and k % 2 == 0: print "YES" elif ct / 2 < k and (k - (ct / 2)) % 2 == 0: print "YES" else: print "NO"