#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define MAX_MOD 1000000007 #define REP(i,n) for(long long i = 0;i < n;++i) #define LONG_INF 800000000000000000 int main() { long long n, k; cin >> n >> k; vector nara; map wow; REP(i, n) { int tmp; cin >> tmp; nara.push_back(tmp); wow[tmp] = i; } for (int i = 0;i < n;++i) { if (nara[i] != i + 1) { //入れ替えるのはiとwow[i+1]の値 k--; pair hogee = make_pair(i, wow[i + 1]); wow[nara[i]] = wow[i + 1]; wow[i + 1] = i; swap(nara[hogee.first], nara[hogee.second]); } } if (k % 2 == 0) { cout << "YES" << endl; } else cout << "NO" << endl; return 0; }