#include using namespace std; void solve() { int n, k; cin >> n >> k; int d[n]; for (int i = 0; i < n; i++) { cin >> d[i]; } int cnt = 0; for (int i = 0; i < n - 1; i++) { if (d[i] == i + 1) { continue; } for (int j = i + 1; j < n; j++) { if (d[j] == i + 1) { int tmp = d[i]; d[i] = d[j]; d[j] = tmp; cnt++; break; } } if (cnt > k) { cout << "NO" << endl; return; } } if ((k - cnt) % 2 == 0) { cout << "YES" << endl; } else { cout << "NO" << endl; } } int main(int argc, char *argv[]) { solve(); return 0; }