#include #define rep(i,n) for(int i=(0);i<(n);i++) using namespace std; typedef long long ll; typedef unsigned long long ull; template bool chmax(T &a, const T &b) { if (a bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } // class const int max_n = 202020; class BinaryIndexedTree{ private: int n; ll bit[max_n]; public: BinaryIndexedTree(int n){ this -> n = n; } ll sum(int i){ ll s = 0; while(i > 0){ s += bit[i]; i -= i & (-i); } return s; } void add(int i, ll x){ while(i <= n){ bit[i] += x; i += i & (-i); } } }; int main(){ cin.tie(0); ios::sync_with_stdio(false); ll n, k; cin >> n >> k; vector a(n); rep(i, n) cin >> a[i]; BinaryIndexedTree bit(n); ll ans = 0ll; for(ll i = 0; i < n; i++){ ans += i - bit.sum(a[i]); bit.add(a[i], 1ll); } if(ans == k || (ans <= k && (ans % 2 == k % 2))){ cout << "YES" << endl; }else{ cout << "NO" << endl; } }