#include #include using namespace std; typedef long long LL; bool check(vector &D) { for (int i=1;i>N>>K; int i,j; vector D(N+1,0); for (i=1;i<=N;i++){ cin>>D[i]; } int d1; i=1; while(true){ if (D[i]==i){ i++; if (i==N){ break; } continue; } swap(D[D[i]],D[i]); //i=1; K--; if (K==0){ break; }else if (K<0){ cout<<"NO"<