#include using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N, K; cin >> N >> K; ll sum = 0; for(int i = 0; i < N; i++) { int d; cin >> d; d--; if(i != d) sum++; } if(sum == 0) { if(K % 2 == 0) { cout << "YES" << endl; } else { cout << "NO" << endl; } } else if(sum <= 3) { if(sum - 1 <= K && K % 2 != sum % 2) { cout << "YES" << endl; } else { cout << "NO" << endl; } } else { if(sum - 1 <= K) { cout << "YES" << endl; } else { cout << "NO" << endl; } } }