#include #include #include using namespace std; using ll = long long; using P = pair; int main(void){ int n, k; cin >> n >> k; vector p(n), q(n); for(auto&x:p) cin >> x; vector

ans; for(int i=0; i id, val; for(int j=i; jp[id[j+1]]){ ans.emplace_back(id[j]+1, id[j+1]+1); swap(p[id[j]], p[id[j+1]]); esc=true; break; } } } } q=p; sort(begin(q), end(q)); if(p!=q) cout << -1 << endl; else{ cout << ans.size() << endl; for(auto [x, y]:ans) cout << x << ' ' << y << '\n'; } return 0; }