/* -*- coding: utf-8 -*- * * 482.cc: No.482 あなたの名は - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 200000; /* typedef */ typedef long long ll; typedef vector vi; typedef queue qi; typedef pair pii; /* global variables */ int ds[MAX_N], es[MAX_N]; /* subroutines */ /* main */ int main() { int n; ll k; scanf("%d%lld", &n, &k); for (int i = 0; i < n; i++) { scanf("%d", &ds[i]); ds[i]--; es[ds[i]] = i; } int c = 0; for (int i = 0; i < n; i++) { int j = es[i]; if (i != j) { swap(ds[i], ds[j]); swap(es[ds[i]], es[ds[j]]); c++; } } //for (int i = 0; i < n; i++) printf("%d ", ds[i]); putchar('\n'); //for (int i = 0; i < n; i++) printf("%d ", es[i]); putchar('\n'); //printf("c=%d\n", c); if (k >= c && ((k - c) & 1LL) == 0LL) puts("YES"); else puts("NO"); return 0; }