import math if __name__ == '__main__': n, k = map(int, input().split()) ds = list(map(int, input().split())) cnt = sum(1 for i, d in enumerate(ds) if d != i + 1) t = math.ceil(cnt / 2) print("YES" if (k - t) % 2 == 0 else "NO")