#include using namespace std; typedef long long LL; const int N = 200010; int n, k, a[N], b[N]; LL cnt; int main() { // freopen("soul.in", "r", stdin); // freopen("soul.out", "w", stdout); scanf("%d%d", &n, &k); for (int i = 1; i <= n; ++i) { scanf("%d", &a[i]); b[a[i]] = i; } for (int i = 1; i <= n; ++i) { if (i != b[i]) { swap(a[i], a[b[a[i]]]); int temp1 = b[i], temp2 = b[a[i]]; b[a[i]] = temp1; b[i] = temp2; ++cnt; } } if (cnt <= k && (k - cnt) % 2 == 0) puts("YES"); else puts("NO"); return 0; }