#include <iostream> #include <utility> #include <cstdio> #include <queue> #include <stack> #include <algorithm> #include <numeric> #include <vector> #include <set> #include <map> #include <string> #include <cstring> using namespace std; #define ALL(a) (a).begin(), (a).end() using ll = long long; using P = pair<int, int>; #define int ll struct State { int v, cost; State(int v, int cost): v(v), cost(cost) {} // 昇順 bool operator<(const State& s) const { return cost < s.cost; } // 降順 bool operator>(const State& s) const { return cost > s.cost; } }; void dump_vector(vector<int> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << (i < vec.size() - 1 ? " " : "\n"); } } signed main() { int n; ll k; cin >> n >> k; vector<int> d(n), pos(n); for (int i = 0; i < n; i++) { cin >> d[i]; d[i]--; pos[d[i]] = i; } ll swap_cnt = 0; for (int i = 0; i < n; i++) { if (d[i] != i) { swap_cnt++; int temp = d[i]; swap(d[i], d[pos[i]]); swap(pos[i], pos[temp]); } } // cout << "swap回数は" << swap_cnt << endl; if (swap_cnt > k) { cout << "NO" << endl; } else if ((k - swap_cnt) % 2 == 0) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }