#include using namespace std; int main() { long long N, K, D[200000], rev[200000]; cin >> N >> K; for(int i = 0; i < N; i++) { cin >> D[i]; --D[i]; rev[D[i]] = i; } int y = 0; for(int i = 0; i < N; i++) { if(i != D[i]) { rev[D[i]] = rev[i]; swap(D[i], D[rev[i]]); ++y; } } if(y <= K && y % 2 == K % 2) { cout << "YES" << endl; } else { cout << "NO" << endl; } }