#include using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair P; int main(){ int n; ll k; cin >> n >> k; vector d(n); rep(i,n) cin >> d[i], --d[i]; rep(i,n) { if (i == d[i]) continue; if (k == 0) { cout << "NO" << endl; return 0; } swap(d[i], d[d[i]]); --k; --i; } if (k % 2 == 0) cout << "YES" << endl; else cout << "NO" << endl; return 0; }