#include using namespace std; typedef long long LL; int n, cnt; LL k; int main() { scanf("%d%lld", &n, &k); for (int i = 1, x; i <= n; ++i) { scanf("%d", &x); if (x != i) ++cnt; } if (k == 1) puts(cnt == 2 ? "YES" : "NO"); else if (k % 2 == 1) puts(cnt == 2 || (4 <= cnt && cnt <= k * 2) ? "YES" : "NO"); else puts(cnt == 0 || (3 <= cnt && cnt <= k * 2) ? "YES" : "NO"); return 0; }