#include #include #include #include #include #include #include #include #include #include #include #include #define mod 1000000007; using namespace std; typedef long long ll; typedef pair Pr; ll N, K; ll D[200010],ind[200010]; int main() { cin >> N >> K; for (ll i = 1; i <= N; i++) { cin >> D[i]; ind[i] = D[i]; } ll cnt = 0; for (ll i = 1; i <= N; i++) { if (D[i] != i) { swap(D[ind[i]],D[i]); cnt++; } } cout << cnt << endl; if (K < cnt || (K - cnt) % 2 != 0) cout << "NO" << endl; else cout << "YES" << endl; return 0; }