#include<bits/stdc++.h>
using namespace std;
const int N=2e5+2;
int a[N],p[N],head[N],now=0;
pair<int,int> b[N];
vector<int> cycle[N];
int findd(int x){
	if(head[x]<0){
		return x;
	}
	return head[x]=findd(head[x]);
}
void unionn(int x,int y){
	x=findd(x),y=findd(y);
	head[x]+=head[y];
	head[y]=x;
}
bool samee(int x,int y){
	return findd(x)==findd(y);
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,s,sz=0;
	cin>>n>>s;
	for(i=1;i<=n;i++){
		head[i]=-1;
		cin>>a[i];
		b[i]={a[i],i};
	}
	sort(b+1,b+1+n);
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		now++;
		while(i<j){
			a[b[i].second]=now; b[i].first=now;
			i++;
		}
	}
	for(i=1;i<=n;i++){
		if(a[i]!=b[i].first){
			sz++;
			head[i]=-1;
			b[sz]={a[i],i};
			a[sz]=i;
		}
	}
	if(sz==0){
		cout<<0;
		return 0;
	}
	if(sz>s){
		cout<<-1;
		return 0;
	}
	sort(b+1,b+1+sz);
	sort(a+1,a+1+sz);
	for(i=1;i<=sz;i++){
		p[b[i].second]=a[i];
		if(!samee(b[i].second,a[i])){
			unionn(b[i].second,a[i]);
		}
	}
	i=j=1;
	while(i<=sz){
		while(j<=sz&&b[i].first==b[j].first){
			j++;
		}
		for(k=i+1;k<j;k++){
			if(!samee(b[i].second,b[k].second)){
				swap(p[b[i].second],p[b[k].second]);
				unionn(b[i].second,b[k].second);
			}
		}
		i=j;
	}
//	for(i=1;i<=n;i++){
//		cout<<p[i]<<' ';
//	}
//	cout<<endl;
	int cnt=0;
	for(i=1;i<=sz;i++){
		if(p[a[i]]){
			cycle[cnt].push_back(a[i]);
			j=p[a[i]];
			while(j!=a[i]){
				cycle[cnt].push_back(j);
				j=p[j];
			}
			for(k=0;k<cycle[cnt].size();k++){
				p[cycle[cnt][k]]=0;
			}
			cnt++;
		}
	}
	if(cnt<=1||s==sz+1||s==sz){
		cout<<cnt<<'\n';
		for(i=0;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
	}
	else{
		cout<<cnt-min(cnt,s-sz)+2<<'\n';
		int z=min(s-sz,cnt);
		for(i=z;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
		cout<<z<<'\n';
		k=0;
		for(i=0;i<z;i++){
			k+=cycle[i].size();
			cout<<cycle[i][0]<<' ';
		}
		cout<<'\n';
		cout<<k<<'\n';
		for(i=z-1;i>-1;i--){
			for(l=1;l<cycle[i].size();l++){
				cout<<cycle[i][l]<<' ';
			}
			cout<<cycle[i][0]<<' ';
		}
	}
}
/*
6 9
2 1 4 3 6 5
*/


#include<bits/stdc++.h>
using namespace std;
const int N=2e5+2;
int a[N],p[N],head[N],now=0,idx[N];
pair<int,int> b[N];
int findd(int x){
	if(head[x]<0){
		return x;
	}
	int y=findd(head[x]);
	head[x]=y;
	return y;
}
void unionn(int x,int y){
	x=findd(x),y=findd(y);
	if(x==y){
		return;
	}
	head[x]+=head[y];
	head[y]=x;
}
bool samee(int x,int y){
	return findd(x)==findd(y);
}
vector<int> cycle[N];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,s,sz=0;
	cin>>n>>s;
	for(i=1;i<=n;i++){
		head[i]=-1;
		cin>>a[i];
		b[i]={a[i],i};
	}
	sort(b+1,b+1+n);
	now=0;
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		now++;
		while(i<j){
			b[i].first=now;
			a[b[i].second]=now;
			i++;
		}
	}
	for(i=1;i<=n;i++){
		if(a[i]!=b[i].first){
			sz++;
			head[i]=-1;
			b[sz]={a[i],i};
			idx[sz]=i;
		}
	}
	if(sz==0){
		cout<<0;
		return 0;
	}
	if(sz>s){
		cout<<-1;
		return 0;
	}
	sort(b+1,b+1+sz);
	sort(idx+1,idx+1+sz);
	for(i=1;i<=sz;i++){
		p[b[i].second]=idx[i];
		unionn(b[i].second,idx[i]);
	}
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		for(k=i+1;k<j;k++){
			if(!samee(b[i].second,b[k].second)){
				swap(p[b[i].second],p[b[k].second]);
				unionn(b[i].second,b[k].second);
			}
		}
		i=j;
	}
//	for(i=1;i<=n;i++){
//		cout<<p[i]<<' ';
//	}
//	cout<<endl;
	int cnt=0;
	for(i=1;i<=n;i++){
		if(p[i]){
			cycle[cnt].push_back(i);
			j=p[i];
			while(j!=i){
				cycle[cnt].push_back(j);
				j=p[j];
			}
			for(k=0;k<cycle[cnt].size();k++){
				p[cycle[cnt][k]]=0;
			}
			cnt++;
			assert(cnt<=sz);
		}
	}
	if(cnt<=1||s==sz+1||s==sz){
		cout<<cnt<<'\n';
		for(i=0;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
	}
	else{
		cout<<cnt-min(cnt,s-sz)+2<<'\n';
		j=min(s-sz,cnt);
		for(i=j;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
		cout<<j<<'\n';
		k=0;
		for(i=0;i<j;i++){
			k+=cycle[i].size();
			cout<<cycle[i][0]<<' ';
		}
		cout<<'\n';
		cout<<k<<'\n';
		for(i=j-1;i>-1;i--){
			for(l=1;l<cycle[i].size();l++){
				cout<<cycle[i][l]<<' ';
			}
			cout<<cycle[i][0]<<' ';
		}
	}
}
/*
6 9
2 1 4 3 6 5
*/


#include<bits/stdc++.h>
using namespace std;
const int N=2e5+2;
int a[N],p[N],head[N],now=0,idx[N];
pair<int,int> b[N],c[N];
int findd(int x){
	if(head[x]<0){
		return x;
	}
	return head[x]=findd(head[x]);
}
void unionn(int x,int y){
	x=findd(x),y=findd(y);
	if(x==y){
		return;
	}
	head[x]+=head[y];
	head[y]=x;
}
bool samee(int x,int y){
	return findd(x)==findd(y);
}
vector<vector<int> > cycle;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,s,cnt=0,sz=0;
	cin>>n>>s;
	for(i=1;i<=n;i++){
		head[i]=-1;
		cin>>a[i];
		b[i]={a[i],i};
	}
	sort(b+1,b+1+n);
	now=0;
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		now++;
		while(i<j){
			b[i].first=now;
			a[b[i].second]=now;
			i++;
		}
	}
	for(i=1;i<=n;i++){
		if(a[i]!=b[i].first){
			sz++;
			head[i]=-1;
			c[sz]={a[i],i};
			idx[sz]=i;
		}
	}
	if(sz==0){
		cout<<0;
		return 0;
	}
	if(sz>s){
		cout<<-1;
		return 0;
	}
	sort(c+1,c+1+sz);
	sort(idx+1,idx+1+sz);
	for(i=1;i<=sz;i++){
		p[c[i].second]=idx[i];
		unionn(c[i].second,idx[i]);
	}
	i=j=1;
	while(i<=n){
		while(j<=n&&c[i].first==c[j].first){
			j++;
		}
		for(k=i+1;k<j;k++){
			if(!samee(c[i].second,c[k].second)){
				swap(p[c[i].second],p[c[k].second]);
				unionn(c[i].second,c[k].second);
			}
		}
		i=j;
	}
//	for(i=1;i<=n;i++){
//		cout<<p[i]<<' ';
//	}
//	cout<<endl;
	for(i=1;i<=n;i++){
		if(p[i]){
			cnt++;
			vector<int> wow;
			wow.push_back(i);
			j=p[i];
			while(j!=i){
				wow.push_back(j);
				j=p[j];
			}
			for(k=0;k<wow.size();k++){
				p[wow[k]]=false;
			}
			cycle.push_back(wow);
		}
	}
	if(cycle.size()<=1||s==sz+1||s==sz){
		cout<<cycle.size()<<'\n';
		for(i=0;i<cycle.size();i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
	}
	else{
		cout<<cycle.size()-min((int)cycle.size(),s-sz)+2<<'\n';
		j=min(s-sz,(int)cycle.size());
		for(i=j;i<cycle.size();i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
		cout<<j<<'\n';
		k=0;
		for(i=0;i<j;i++){
			k+=cycle[i].size();
			cout<<cycle[i][0]<<' ';
		}
		cout<<'\n';
		cout<<k<<'\n';
		for(i=j-1;i>-1;i--){
			for(l=1;l<cycle[i].size();l++){
				cout<<cycle[i][l]<<' ';
			}
			cout<<cycle[i][0]<<' ';
		}
	}
}
/*
6 9
2 1 4 3 6 5
*/


#include<bits/stdc++.h>
using namespace std;
const int N=2e5+1;
int a[N],p[N],head[N],now=0;
pair<int,int> b[N];
int findd(int x){
	if(head[x]<0){
		return x;
	}
	int y=findd(head[x]);
	head[x]=y;
	return y;
}
void unionn(int x,int y){
	x=findd(x),y=findd(y);
	if(x==y){
		return;
	}
	head[x]+=head[y];
	head[y]=x;
}
bool samee(int x,int y){
	return findd(x)==findd(y);
}
vector<int> cycle[N];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,s,sz=0;
	cin>>n>>s;
	for(i=1;i<=n;i++){
		head[i]=-1;
		cin>>a[i];
		b[i]={a[i],i};
	}
	sort(b+1,b+1+n);
	now=0;
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		now++;
		while(i<j){
			b[i].first=now;
			a[b[i].second]=now;
			i++;
		}
	}
	for(i=1;i<=n;i++){
		if(a[i]!=b[i].first){
			sz++;
			head[i]=-1;
			b[sz]={a[i],i};
			a[sz]=i;
		}
	}
	if(sz==0){
		cout<<0;
		return 0;
	}
	if(sz>s){
		cout<<-1;
		return 0;
	}
	sort(b+1,b+1+sz);
	sort(a+1,a+1+sz);
	for(i=1;i<=sz;i++){
		p[b[i].second]=a[i];
		unionn(b[i].second,a[i]);
	}
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		for(k=i+1;k<j;k++){
			if(!samee(b[i].second,b[k].second)){
				swap(p[b[i].second],p[b[k].second]);
				unionn(b[i].second,b[k].second);
			}
		}
		i=j;
	}
//	for(i=1;i<=n;i++){
//		cout<<p[i]<<' ';
//	}
//	cout<<endl;
	int cnt=0;
	for(i=1;i<=n;i++){
		if(p[i]){
			cycle[cnt].push_back(i);
			j=p[i];
			while(j!=i){
				cycle[cnt].push_back(j);
				j=p[j];
			}
			for(k=0;k<cycle[cnt].size();k++){
				p[cycle[cnt][k]]=0;
			}
			cnt++;
		}
	}
	if(cnt<=1||s==sz+1||s==sz){
		cout<<cnt<<'\n';
		for(i=0;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
	}
	else{
		cout<<cnt-min(cnt,s-sz)+2<<'\n';
		j=min(s-sz,cnt);
		for(i=j;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
		cout<<j<<'\n';
		k=0;
		for(i=0;i<j;i++){
			k+=cycle[i].size();
			cout<<cycle[i][0]<<' ';
		}
		cout<<'\n';
		cout<<k<<'\n';
		for(i=j-1;i>-1;i--){
			for(l=1;l<cycle[i].size();l++){
				cout<<cycle[i][l]<<' ';
			}
			cout<<cycle[i][0]<<' ';
		}
	}
}
/*
6 9
2 1 4 3 6 5
*/


#include<bits/stdc++.h>
using namespace std;
const int N=2e5+2;
int a[N],p[N],head[N],now=0;
pair<int,int> b[N];
vector<int> cycle[N];
int findd(int x){
	if(head[x]<0){
		return x;
	}
	int y=findd(head[x]);
	head[x]=y;
	return y;
}
void unionn(int x,int y){
	x=findd(x),y=findd(y);
	if(x==y){
		return;
	}
	head[x]+=head[y];
	head[y]=x;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,s,sz=0;
	cin>>n>>s;
	for(i=1;i<=n;i++){
		head[i]=-1;
		cin>>a[i];
		b[i]={a[i],i};
	}
	sort(b+1,b+1+n);
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		now++;
		while(i<j){
			b[i].first=now;
			a[b[i].second]=now;
			i++;
		}
	}
	for(i=1;i<=n;i++){
		if(a[i]!=b[i].first){
			sz++;
			head[i]=-1;
			b[sz]={a[i],i};
			a[sz]=i;
		}
	}
	if(sz==0){
		cout<<0;
		return 0;
	}
	if(sz>s){
		cout<<-1;
		return 0;
	}
	sort(b+1,b+1+sz);
	sort(a+1,a+1+sz);
	for(i=1;i<=sz;i++){
		p[b[i].second]=a[i];
		if(!samee(b[i].second,a[i])){
			unionn(b[i].second,a[i]);
		}
	}
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		for(k=i+1;k<j;k++){
			if(!samee(b[i].second,b[k].second)){
				swap(p[b[i].second],p[b[k].second]);
				unionn(b[i].second,b[k].second);
			}
		}
		i=j;
	}
//	for(i=1;i<=n;i++){
//		cout<<p[i]<<' ';
//	}
//	cout<<endl;
	int cnt=0;
	if(n<200000){
		for(i=1;i<=n;i++){
			if(p[i]){
				cycle[cnt].push_back(i);
				j=p[i];
				while(j!=i){
					cycle[cnt].push_back(j);
					j=p[j];
				}
				for(k=0;k<cycle[cnt].size();k++){
					p[cycle[cnt][k]]=0;
				}
				cnt++;
			}
		}
	}
	if(cnt<=1||s==sz+1||s==sz){
		cout<<cnt<<'\n';
		for(i=0;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
	}
	else{
		cout<<cnt-min(cnt,s-sz)+2<<'\n';
		j=min(s-sz,cnt);
		for(i=j;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
		cout<<j<<'\n';
		k=0;
		for(i=0;i<j;i++){
			k+=cycle[i].size();
			cout<<cycle[i][0]<<' ';
		}
		cout<<'\n';
		cout<<k<<'\n';
		for(i=j-1;i>-1;i--){
			for(l=1;l<cycle[i].size();l++){
				cout<<cycle[i][l]<<' ';
			}
			cout<<cycle[i][0]<<' ';
		}
	}
}
/*
6 9
2 1 4 3 6 5
*/


#include<bits/stdc++.h>
using namespace std;
const int N=2e5+1;
int a[N],p[N],head[N],now=0;
pair<int,int> b[N];
vector<int> cycle[N];
int findd(int x){
	if(head[x]<0){
		return x;
	}
	int y=findd(head[x]);
	head[x]=y;
	return y;
}
void unionn(int x,int y){
	x=findd(x),y=findd(y);
	head[x]+=head[y];
	head[y]=x;
}
bool samee(int x,int y){
	return findd(x)==findd(y);
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,s,sz=0;
	cin>>n>>s;
	for(i=1;i<=n;i++){
		head[i]=-1;
		cin>>a[i];
		b[i]={a[i],i};
	}
	sort(b+1,b+1+n);
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		now++;
		while(i<j){
			b[i].first=now;
			a[b[i].second]=now;
			i++;
		}
	}
	for(i=1;i<=n;i++){
		if(a[i]!=b[i].first){
			sz++;
			head[i]=-1;
			b[sz]={a[i],i};
			a[sz]=i;
		}
	}
	if(sz==0){
		cout<<0;
		return 0;
	}
	if(sz>s){
		cout<<-1;
		return 0;
	}
	sort(b+1,b+1+sz);
	sort(a+1,a+1+sz);
	for(i=1;i<=sz;i++){
		p[b[i].second]=a[i];
		if(!samee(b[i].second,a[i])){
			unionn(b[i].second,a[i]);
		}
	}
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		for(k=i+1;k<j;k++){
			if(!samee(b[i].second,b[k].second)){
				swap(p[b[i].second],p[b[k].second]);
				unionn(b[i].second,b[k].second);
			}
		}
		i=j;
	}
//	for(i=1;i<=n;i++){
//		cout<<p[i]<<' ';
//	}
//	cout<<endl;
	int cnt=0;
	for(i=1;i<=n;i++){
		if(p[i]){
			cycle[cnt].push_back(i);
			j=p[i];
			while(j!=i){
				cycle[cnt].push_back(j);
				j=p[j];
			}
			for(k=0;k<cycle[cnt].size();k++){
				p[cycle[cnt][k]]=0;
			}
			cnt++;
		}
	}
	if(cnt<=1||s==sz+1||s==sz){
		cout<<cnt<<'\n';
		for(i=0;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
	}
	else{
		cout<<cnt-min(cnt,s-sz)+2<<'\n';
		j=min(s-sz,cnt);
		for(i=j;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
		cout<<j<<'\n';
		k=0;
		for(i=0;i<j;i++){
			k+=cycle[i].size();
			cout<<cycle[i][0]<<' ';
		}
		cout<<'\n';
		cout<<k<<'\n';
		for(i=j-1;i>-1;i--){
			for(l=1;l<cycle[i].size();l++){
				cout<<cycle[i][l]<<' ';
			}
			cout<<cycle[i][0]<<' ';
		}
	}
}
/*
6 9
2 1 4 3 6 5
*/


#include<bits/stdc++.h>
using namespace std;
const int N=2e5+1;
int a[N],p[N],head[N],now=0;
pair<int,int> b[N];
vector<int> cycle[N];
int findd(int x){
	if(head[x]<0){
		return x;
	}
	int y=findd(head[x]);
	head[x]=y;
	return y;
}
void unionn(int x,int y){
	x=findd(x),y=findd(y);
	head[x]+=head[y];
	head[y]=x;
}
bool samee(int x,int y){
	return findd(x)==findd(y);
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,s,sz=0;
	cin>>n>>s;
	for(i=1;i<=n;i++){
		head[i]=-1;
		cin>>a[i];
		b[i]={a[i],i};
	}
	sort(b+1,b+1+n);
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		now++;
		while(i<j){
			b[i].first=now;
			a[b[i].second]=now;
			i++;
		}
	}
	for(i=1;i<=n;i++){
		if(a[i]!=b[i].first){
			sz++;
			head[i]=-1;
			b[sz]={a[i],i};
			a[sz]=i;
		}
	}
	if(sz==0){
		cout<<0;
		return 0;
	}
	if(sz>s){
		cout<<-1;
		return 0;
	}
	sort(b+1,b+1+sz);
	sort(a+1,a+1+sz);
	for(i=1;i<=sz;i++){
		p[b[i].second]=a[i];
		if(!samee(b[i].second,a[i])){
			unionn(b[i].second,a[i]);
		}
	}
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		for(k=i+1;k<j;k++){
			if(!samee(b[i].second,b[k].second)){
				swap(p[b[i].second],p[b[k].second]);
				unionn(b[i].second,b[k].second);
			}
		}
		i=j;
	}
//	for(i=1;i<=n;i++){
//		cout<<p[i]<<' ';
//	}
//	cout<<endl;
	int cnt=0;
	if(n+1<N){
		for(i=1;i<=n;i++){
			if(p[i]){
				cycle[cnt].push_back(i);
				j=p[i];
				while(j!=i){
					cycle[cnt].push_back(j);
					j=p[j];
				}
				for(k=0;k<cycle[cnt].size();k++){
					p[cycle[cnt][k]]=0;
				}
				cnt++;
			}
		}
	}
	if(cnt<=1||s==sz+1||s==sz){
		cout<<cnt<<'\n';
		for(i=0;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
	}
	else{
		cout<<cnt-min(cnt,s-sz)+2<<'\n';
		j=min(s-sz,cnt);
		for(i=j;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
		cout<<j<<'\n';
		k=0;
		for(i=0;i<j;i++){
			k+=cycle[i].size();
			cout<<cycle[i][0]<<' ';
		}
		cout<<'\n';
		cout<<k<<'\n';
		for(i=j-1;i>-1;i--){
			for(l=1;l<cycle[i].size();l++){
				cout<<cycle[i][l]<<' ';
			}
			cout<<cycle[i][0]<<' ';
		}
	}
}
/*
6 9
2 1 4 3 6 5
*/


#include<bits/stdc++.h>
using namespace std;
const int N=2e5+2;
int a[N],p[N],head[N],now=0,idx[N];
pair<int,int> b[N],c[N];
int findd(int x){
	if(head[x]<0){
		return x;
	}
	return head[x]=findd(head[x]);
}
void unionn(int x,int y){
	x=findd(x),y=findd(y);
	if(x==y){
		return;
	}
	head[x]+=head[y];
	head[y]=x;
}
bool samee(int x,int y){
	return findd(x)==findd(y);
}
vector<vector<int> > cycle;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,s,cnt=0,sz=0;
	cin>>n>>s;
	for(i=1;i<=n;i++){
		head[i]=-1;
		cin>>a[i];
		b[i]={a[i],i};
	}
	sort(b+1,b+1+n);
	now=0;
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		now++;
		while(i<j){
			b[i].first=now;
			a[b[i].second]=now;
			i++;
		}
	}
	for(i=1;i<=n;i++){
		if(a[i]!=b[i].first){
			sz++;
			head[i]=-1;
			c[sz]={a[i],i};
			idx[sz]=i;
		}
	}
	if(sz==0){
		cout<<0;
		return 0;
	}
	if(sz>s){
		cout<<-1;
		return 0;
	}
	sort(c+1,c+1+sz);
	sort(idx+1,idx+1+sz);
	for(i=1;i<=sz;i++){
		p[c[i].second]=idx[i];
		unionn(c[i].second,idx[i]);
	}
	i=j=1;
	while(i<=n){
		while(j<=n&&c[i].first==c[j].first){
			j++;
		}
		for(k=i+1;k<j;k++){
			if(!samee(c[i].second,c[k].second)){
				swap(p[c[i].second],p[c[k].second]);
				unionn(c[i].second,c[k].second);
			}
		}
		i=j;
	}
//	for(i=1;i<=n;i++){
//		cout<<p[i]<<' ';
//	}
//	cout<<endl;
	for(i=1;i<=n;i++){
		if(p[i]){
			vector<int> wow;
			wow.push_back(i);
			j=p[i];
			while(j!=i){
				wow.push_back(j);
				j=p[j];
			}
			for(k=0;k<wow.size();k++){
				p[wow[k]]=0;
			}
			cycle.push_back(wow);
		}
	}
	if(cycle.size()<=1||s==sz+1||s==sz){
		cout<<cycle.size()<<'\n';
		for(i=0;i<cycle.size();i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
	}
	else{
		cout<<cycle.size()-min((int)cycle.size(),s-sz)+2<<'\n';
		j=min(s-sz,(int)cycle.size());
		for(i=j;i<cycle.size();i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
		cout<<j<<'\n';
		k=0;
		for(i=0;i<j;i++){
			k+=cycle[i].size();
			cout<<cycle[i][0]<<' ';
		}
		cout<<'\n';
		cout<<k<<'\n';
		for(i=j-1;i>-1;i--){
			for(l=1;l<cycle[i].size();l++){
				cout<<cycle[i][l]<<' ';
			}
			cout<<cycle[i][0]<<' ';
		}
	}
}
/*
6 9
2 1 4 3 6 5
*/


#include<bits/stdc++.h>
using namespace std;
const int N=2e5+2;
int a[N],p[N],head[N],now=0;
pair<int,int> b[N];
vector<int> cycle[N];
int findd(int x){
	if(head[x]<0){
		return x;
	}
	int y=findd(head[x]);
	head[x]=y;
	return y;
}
void unionn(int x,int y){
	head[x]+=head[y];
	head[y]=x;
}
bool samee(int x,int y){
	return findd(x)==findd(y);
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,s,sz=0;
	cin>>n>>s;
	for(i=1;i<=n;i++){
		head[i]=-1;
		cin>>a[i];
		b[i]={a[i],i};
	}
	sort(b+1,b+1+n);
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		now++;
		while(i<j){
			b[i].first=now;
			a[b[i].second]=now;
			i++;
		}
	}
	for(i=1;i<=n;i++){
		if(a[i]!=b[i].first){
			sz++;
			head[i]=-1;
			b[sz]={a[i],i};
			a[sz]=i;
		}
	}
	if(sz==0){
		cout<<0;
		return 0;
	}
	if(sz>s){
		cout<<-1;
		return 0;
	}
	sort(b+1,b+1+sz);
	sort(a+1,a+1+sz);
	for(i=1;i<=sz;i++){
		p[b[i].second]=a[i];
		if(!samee(b[i].second,a[i])){
			unionn(b[i].second,a[i]);
		}
	}
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		for(k=i+1;k<j;k++){
			if(!samee(b[i].second,b[k].second)){
				swap(p[b[i].second],p[b[k].second]);
				unionn(b[i].second,b[k].second);
			}
		}
		i=j;
	}
//	for(i=1;i<=n;i++){
//		cout<<p[i]<<' ';
//	}
//	cout<<endl;
	int cnt=0;
	if(n<200000){
		for(i=1;i<=n;i++){
			if(p[i]){
				cycle[cnt].push_back(i);
				j=p[i];
				while(j!=i){
					cycle[cnt].push_back(j);
					j=p[j];
				}
				for(k=0;k<cycle[cnt].size();k++){
					p[cycle[cnt][k]]=0;
				}
				cnt++;
			}
		}
	}
	if(cnt<=1||s==sz+1||s==sz){
		cout<<cnt<<'\n';
		for(i=0;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
	}
	else{
		cout<<cnt-min(cnt,s-sz)+2<<'\n';
		j=min(s-sz,cnt);
		for(i=j;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
		cout<<j<<'\n';
		k=0;
		for(i=0;i<j;i++){
			k+=cycle[i].size();
			cout<<cycle[i][0]<<' ';
		}
		cout<<'\n';
		cout<<k<<'\n';
		for(i=j-1;i>-1;i--){
			for(l=1;l<cycle[i].size();l++){
				cout<<cycle[i][l]<<' ';
			}
			cout<<cycle[i][0]<<' ';
		}
	}
}
/*
6 9
2 1 4 3 6 5
*/


#include<bits/stdc++.h>
using namespace std;
const int N=2e5+2;
int a[N],p[N],head[N],now=0;
pair<int,int> b[N];
vector<int> cycle[N];
int findd(int x){
	if(head[x]<0){
		return x;
	}
	int y=findd(head[x]);
	head[x]=y;
	return y;
}
void unionn(int x,int y){
	x=findd(x),y=findd(y);
	head[x]+=head[y];
	head[y]=x;
}
bool samee(int x,int y){
	return findd(x)==findd(y);
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,s,sz=0;
	cin>>n>>s;
	for(i=1;i<=n;i++){
		head[i]=-1;
		cin>>a[i];
		b[i]={a[i],i};
	}
	sort(b+1,b+1+n);
	i=j=1;
	while(i<=n){
		while(j<=n&&b[i].first==b[j].first){
			j++;
		}
		now++;
		while(i<j){
			a[b[i].second]=now; b[i].first=now;
			i++;
		}
	}
	for(i=1;i<=n;i++){
		if(a[i]!=b[i].first){
			sz++;
			head[i]=-1;
			b[sz]={a[i],i};
			a[sz]=i;
		}
	}
	if(sz==0){
		cout<<0;
		return 0;
	}
	if(sz>s){
		cout<<-1;
		return 0;
	}
	sort(b+1,b+1+sz);
	sort(a+1,a+1+sz);
	for(i=1;i<=sz;i++){
		p[b[i].second]=a[i];
		if(!samee(b[i].second,a[i])){
			unionn(b[i].second,a[i]);
		}
	}
	i=j=1;
	while(i<=sz){
		while(j<=sz&&b[i].first==b[j].first){
			j++;
		}
		for(k=i+1;k<j;k++){
			if(!samee(b[i].second,b[k].second)){
				swap(p[b[i].second],p[b[k].second]);
				unionn(b[i].second,b[k].second);
			}
		}
		i=j;
	}
//	for(i=1;i<=n;i++){
//		cout<<p[i]<<' ';
//	}
//	cout<<endl;
	int cnt=0;
	for(i=1;i<=sz;i++){
		if(p[a[i]]){
			cycle[cnt].push_back(a[i]);
			j=p[a[i]];
			while(j!=a[i]){
				cycle[cnt].push_back(j);
				j=p[j];
			}
			for(k=0;k<cycle[cnt].size();k++){
				p[cycle[cnt][k]]=0;
			}
			cnt++;
		}
	}
	if(cnt<=1||s==sz+1||s==sz){
		cout<<cnt<<'\n';
		for(i=0;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
	}
	else{
		cout<<cnt-min(cnt,s-sz)+2<<'\n';
		j=min(s-sz,cnt);
		for(i=j;i<cnt;i++){
			cout<<cycle[i].size()<<'\n';
			for(j=0;j<cycle[i].size();j++){
				cout<<cycle[i][j]<<' ';
			}
			cout<<'\n';
		}
		assert(j>1);
		cout<<j<<'\n';
		k=0;
		for(i=0;i<j;i++){
			k+=cycle[i].size();
			cout<<cycle[i][0]<<' ';
		}
		cout<<'\n';
		assert(k>1);
		cout<<k<<'\n';
		for(i=j-1;i>-1;i--){
			for(l=1;l<cycle[i].size();l++){
				cout<<cycle[i][l]<<' ';
			}
			cout<<cycle[i][0]<<' ';
		}
	}
}
/*
6 9
2 1 4 3 6 5
*/


#include <bits/stdc++.h>

using namespace std;

const int M = 2e5 + 239;

int n, s, a[M], p[M];
pair<int, int> b[M];

int parent[M], r[M];

inline void init()
{
	for (int i = 0; i < n; i++)
	{
		parent[i] = i;
		r[i] = 0;
	}
}

inline int find_set(int p)
{
	if (parent[p] == p) return p;
	return (parent[p] = find_set(parent[p]));
}

inline void merge_set(int i, int j)
{
	i = find_set(i);
	j = find_set(j);
	if (i == j) return;
	if (r[i] > r[j]) swap(i, j);
	if (r[i] == r[j]) r[j]++;
	parent[i] = j;
}

inline bool is_connect(int i, int j)
{
	return (find_set(i) == find_set(j));
}

int t;
bool used[M];
vector<int> c[M];

void dfs(int x)
{
	used[x] = true;
	c[t].push_back(x);
	if (!used[p[x]]) dfs(p[x]);
}

int main()
{
	ios::sync_with_stdio(0);
	cin >> n >> s;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		b[i] = make_pair(a[i], i);
	}
	sort(b, b + n);
	for (int i = 0; i < n; i++) p[b[i].second] = i;
	for (int i = 0; i < n; i++)
		if (a[i] == b[i].first && p[i] != i)
		{
			p[b[i].second] = p[i];
			b[p[i]].second = b[i].second;
			p[i] = i;
			b[i].second = i;
		}
	init();
	for (int i = 0; i < n; i++) merge_set(p[i], i);
	int ls = -1;
	for (int i = 0; i < n; i++)
	{
		if (p[b[i].second] == b[i].second) continue;
		if (ls >= 0 && a[ls] == a[b[i].second])
		{
			int x = ls;
			int y = b[i].second;
			if (is_connect(x, y)) continue;
			merge_set(x, y);
			swap(p[x], p[y]);
		}
		ls = b[i].second;
	}
	t = 0;
	for (int i = 0; i < n; i++)
		if (!used[i] && p[i] != i)
		{
			dfs(i);
			t++;
		}
	int kol = 0;
	for (int i = 0; i < t; i++)
		kol += (int)c[i].size();
	if (kol > s)
	{
		cout << "-1";
		return 0;
	}
	s -= kol;
	s = min(s, t);
	if (s <= 1)
	{
		cout << t << "\n";
		for (int i = 0; i < t; i++)
		{
			cout << c[i].size() << "\n";
			for (int x : c[i])
				cout << (x + 1) << " ";
			cout << "\n";
		}
		return 0;
	}
	cout << (t - s + 2) << "\n";
	for (int i = 0; i < t - s; i++)
	{
		cout << c[i + s].size() << "\n";
		for (int x : c[i + s])
			cout << (x + 1) << " ";
		cout << "\n";
		kol -= (int)c[i + s].size();
	}
	cout << kol << "\n";
	for (int i = 0; i < s; i++)
		for (int x : c[i])
			cout << (x + 1) << " ";
	cout << "\n";
	cout << s << "\n";
	for (int i = s - 1; i >= 0; i--)
		cout << (c[i][0] + 1) << " ";
	cout << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define N 200020

int n, s, a[N], b[N], p[N];

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int rt[N];

int findrt(int x) {
	if (rt[x] != x) rt[x] = findrt(rt[x]);
	return rt[x];
}

int get(int x) {
	return lower_bound(b + 1, b + n + 1, x) - b;
}

map<int, int> S[N];
int c[N];

bool vis[N];

int tot;
vector<int> ans[N];

int q[N];

int main() {
	cin>>n>>s;
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]), b[i] = a[i];
	sort(b + 1, b + n + 1);
	int cnt = n;
	for (int i = 1; i <= n; i ++) if (a[i] == b[i]) q[i] = i, cnt --;
	if (cnt > s) {
		puts("-1");
		return 0;
	}
	vector<int> v;
	for (int i = 1; i <= n; i ++) if (!q[i]) v.push_back(i);
	sort(v.begin(), v.end(), cmp);
//	for (int x:v) cout<<x<<endl;
	for (int i = 1, j = 0; i <= n; i ++) {
		if (q[i]) continue;
		q[i] = v[j];
		j ++;
	}
	for (int i = 1; i <= n; i ++) p[q[i]] = i;
	for (int i = 1; i <= n; i ++) rt[i] = i;
	for (int i = 1; i <= n; i ++) {
		int l = findrt(i), r = findrt(p[i]);
		if (l == r) continue;
		rt[l] = r;
	}
	for (int i = 1; i <= n; i ++) c[i] = get(a[i]);
	for (int i = 1; i <= n; i ++) if (p[i] != i) S[c[i]][findrt(i)] = i;
	for (int i = 1; i <= n; i ++) {
		if (S[i].empty()) continue;
		while (S[i].size() > 1) {
			map<int, int>::iterator it = S[i].begin();
			int x = it->second;
			S[i].erase(it);
			it = S[i].begin();
			int y = it->second;
			int fx = findrt(x), fy = findrt(y);
			if (fx == fy) continue;
			swap(p[x], p[y]);
			rt[fx] = fy;
			S[i][y] = fy;
		}
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) continue;
		if (vis[i]) continue;
		tot ++;
		vector<int> &cur = ans[tot];
		int now = i;
		while (1) {
			vis[now] = 1;
			cur.push_back(now);
			now = p[now];
			if (now == i) break;
		}
	}
	for (int i = 1; i <= tot; i ++){
		cout<<ans[i].size()<<endl;
		for (int x:ans[i]) printf("%d ", x);
		puts("");
	}
}


#include <bits/stdc++.h>
using namespace std;

#define N 200020

int n, s, a[N], b[N], p[N];

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int rt[N];

int findrt(int x) {
	if (rt[x] != x) rt[x] = findrt(rt[x]);
	return rt[x];
}

int get(int x) {
	return lower_bound(b + 1, b + n + 1, x) - b;
}

map<int, int> S;
int c[N];

bool vis[N];

int tot;
vector<int> ans[N];

int q[N];

int main() {
	cin>>n>>s;
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]), b[i] = a[i];
	sort(b + 1, b + n + 1);
	int cnt = n;
	for (int i = 1; i <= n; i ++) if (a[i] == b[i]) q[i] = i, cnt --;
	if (cnt > s) {
		puts("-1");
		return 0;
	}
	vector<int> v;
	for (int i = 1; i <= n; i ++) if (!q[i]) v.push_back(i);
	sort(v.begin(), v.end(), cmp);
	for (int i = 1, j = 0; i <= n; i ++) {
		if (q[i]) continue;
		q[i] = v[j];
		j ++;
	}
	for (int i = 1; i <= n; i ++) p[q[i]] = i;
	for (int i = 1; i <= n; i ++) assert(a[i] == b[p[i]]);
	for (int i = 1; i <= n; i ++) rt[i] = i;
	for (int i = 1; i <= n; i ++) {
		int l = findrt(i), r = findrt(p[i]);
		if (l == r) continue;
		rt[l] = r;
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) continue;
		if (!S.count(a[i])) {
			S[a[i]] = i;
			continue;
		}
		int l = S[a[i]];
		int fl = findrt(l), fr = findrt(i);
		if (fl == fr) continue;
		rt[fr] = fl;
		swap(p[l], p[i]);
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) continue;
		int l = S[a[i]];
		int fl = findrt(l), fr = findrt(i);
		assert(fl == fr);
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) {
			vis[i] = 1;
			continue;
		}
		if (vis[i]) continue;
		tot ++;
		vector<int> &cur = ans[tot];
		int now = i;
		while (1) {
			vis[now] = 1;
			cur.push_back(now);
			now = p[now];
			if (now == i) break;
		}
	}
	int k = s - cnt;
	if (k >= 3) {
		k = min(tot, k);
		vector<int> cur;
		for (int i = 0; i < k; i ++) cur.push_back(ans[tot-i][0]);
		vector<int> &to = ans[tot-k+1];
		for (int i = k - 2; i >= 0; i --) {
			for (int x:ans[tot-i]) to.push_back(x);
		}
		ans[tot-k+2] = cur;
		tot -= k - 2;
	}
	cout<<tot<<endl;
	for (int i = 1; i <= tot; i ++){
		cout<<ans[i].size()<<endl;
		for (int x:ans[i]) printf("%d ", x);
		puts("");
	}
}


#include <bits/stdc++.h>
using namespace std;

#define N 200020

int n, s, a[N], b[N], p[N];

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int rt[N];

int findrt(int x) {
	if (rt[x] != x) rt[x] = findrt(rt[x]);
	return rt[x];
}

int get(int x) {
	return lower_bound(b + 1, b + n + 1, x) - b;
}

map<int, int> S[N];
int c[N];

bool vis[N];

int tot;
vector<int> ans[N];

int q[N];

int main() {
	cin>>n>>s;
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]), b[i] = a[i];
	sort(b + 1, b + n + 1);
	int cnt = n;
	for (int i = 1; i <= n; i ++) if (a[i] == b[i]) q[i] = i, cnt --;
	if (cnt > s) {
		puts("-1");
		return 0;
	}
	vector<int> v;
	for (int i = 1; i <= n; i ++) if (!q[i]) v.push_back(i);
	sort(v.begin(), v.end(), cmp);
	for (int i = 1, j = 0; i <= n; i ++) {
		if (q[i]) continue;
		q[i] = v[j];
		j ++;
	}
	for (int i = 1; i <= n; i ++) p[q[i]] = i;
	for (int i = 1; i <= n; i ++) assert(a[i] == b[p[i]]);
	for (int i = 1; i <= n; i ++) rt[i] = i;
	for (int i = 1; i <= n; i ++) {
		int l = findrt(i), r = findrt(p[i]);
		if (l == r) continue;
		rt[l] = r;
	}
	for (int i = 1; i <= n; i ++) c[i] = get(a[i]), assert(b[c[i]] == a[i]);
	for (int i = 1; i <= n; i ++) if (p[i] != i) S[c[i]][findrt(i)] = i;
	for (int i = 1; i <= n; i ++) {
		if (S[i].empty()) continue;
		while (S[i].size() > 1) {
			map<int, int>::iterator it = S[i].begin();
			int x = it->second;
			S[i].erase(it);
			it = S[i].begin();
			int y = it->second;
			int fx = findrt(x), fy = findrt(y);
			assert(a[x] == a[y]);
			S[i][fy] = y;
			if (fx == fy) continue;
			swap(p[x], p[y]);
			rt[fx] = fy;
		}
	}
	for (int i = 1; i <= n; i ++) S[i].clear();
	for (int i = 1; i <= n; i ++) if (p[i] != i) {
		S[c[i]][findrt(i)] = i;
	}
	for (int i = 1; i <= n; i ++) if (p[i] != i) {
		assert(S[c[i]].size() == 1);
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) {
			vis[i] = 1;
			continue;
		}
		if (vis[i]) continue;
		tot ++;
		vector<int> &cur = ans[tot];
		int now = i;
		while (1) {
			vis[now] = 1;
			cur.push_back(now);
			now = p[now];
			if (now == i) break;
		}
	}
	cout<<tot<<endl;
	for (int i = 1; i <= tot; i ++){
		cout<<ans[i].size()<<endl;
		for (int x:ans[i]) printf("%d ", x);
		puts("");
	}
}


#include <bits/stdc++.h>
using namespace std;

#define N 200020

int n, s, a[N], b[N], p[N];

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int rt[N];

int findrt(int x) {
	if (rt[x] != x) rt[x] = findrt(rt[x]);
	return rt[x];
}

int get(int x) {
	return lower_bound(b + 1, b + n + 1, x) - b;
}

map<int, int> S[N];
int c[N];

bool vis[N];

int tot;
vector<int> ans[N];

int main() {
	cin>>n>>s;
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]), b[i] = a[i];
	sort(b + 1, b + n + 1);
	int cnt = n;
	for (int i = 1; i <= n; i ++) if (a[i] == b[i]) p[i] = i, cnt --;
	if (cnt > s) {
		puts("-1");
		return 0;
	}
	vector<int> v;
	for (int i = 1; i <= n; i ++) if (!p[i]) v.push_back(i);
	sort(v.begin(), v.end(), cmp);
	for (int i = 1, j = 0; i <= n; i ++) {
		if (p[i]) continue;
		p[i] = v[j];
		j ++;
	}
	for (int i = 1; i<= n; i ++) assert(a[p[i]] == b[i]);
	for (int i = 1; i <= n; i ++) rt[i] = i;
	for (int i = 1; i <= n; i ++) {
		int l = findrt(i), r = findrt(p[i]);
		if (l == r) continue;
		rt[l] = r;
	}
	for (int i = 1; i <= n; i ++) c[i] = get(a[i]);
	for (int i = 1; i <= n; i ++) if (p[i] != i) S[c[i]][findrt(i)] = i;
	for (int i = 1; i <= n; i ++) {
		if (S[i].empty()) continue;
		while (S[i].size() > 1) {
			map<int, int>::iterator it = S[i].begin();
			int x = it->second;
			S[i].erase(it);
			it = S[i].begin();
			int y = it->second;
			int fx = findrt(x), fy = findrt(y);
			if (fx == fy) continue;
			swap(p[x], p[y]);
			rt[fx] = fy;
			S[i][y] = fy;
		}
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) continue;
		if (vis[i]) continue;
		tot ++;
		vector<int> &cur = ans[tot];
		int now = i;
		while (1) {
			vis[now] = 1;
			cur.push_back(now);
			now = p[now];
			if (now == i) break;
		}
	}
	cout<<tot<<endl;
	for (int i = 1; i <= tot; i ++){
		cout<<ans[i].size()<<endl;
		for (int x:ans[i]) printf("%d ", x);
		puts("");
	}
}


#include <bits/stdc++.h>
using namespace std;

#define N 200020

int n, s, a[N], b[N], p[N];

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int rt[N];

int findrt(int x) {
	if (rt[x] != x) rt[x] = findrt(rt[x]);
	return rt[x];
}

int get(int x) {
	return lower_bound(b + 1, b + n + 1, x) - b;
}

map<int, int> S[N];
int c[N];

bool vis[N];

int tot;
vector<int> ans[N];

int q[N];

int main() {
	cin>>n>>s;
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]), b[i] = a[i];
	sort(b + 1, b + n + 1);
	int cnt = n;
	for (int i = 1; i <= n; i ++) if (a[i] == b[i]) q[i] = i, cnt --;
	if (cnt > s) {
		puts("-1");
		return 0;
	}
	vector<int> v;
	for (int i = 1; i <= n; i ++) if (!q[i]) v.push_back(i);
	sort(v.begin(), v.end(), cmp);
//	for (int x:v) cout<<x<<endl;
	for (int i = 1, j = 0; i <= n; i ++) {
		if (q[i]) continue;
		q[i] = v[j];
		j ++;
	}
	for (int i = 1; i <= n; i ++) p[q[i]] = i;
	for (int i = 1; i <= n; i ++) assert(a[p[i]] == b[i]);
	for (int i = 1; i <= n; i ++) rt[i] = i;
	for (int i = 1; i <= n; i ++) {
		int l = findrt(i), r = findrt(p[i]);
		if (l == r) continue;
		rt[l] = r;
	}
	for (int i = 1; i <= n; i ++) c[i] = get(a[i]);
	for (int i = 1; i <= n; i ++) if (p[i] != i) S[c[i]][findrt(i)] = i;
	for (int i = 1; i <= n; i ++) {
		if (S[i].empty()) continue;
		while (S[i].size() > 1) {
			map<int, int>::iterator it = S[i].begin();
			int x = it->second;
			S[i].erase(it);
			it = S[i].begin();
			int y = it->second;
			int fx = findrt(x), fy = findrt(y);
			if (fx == fy) continue;
			swap(p[x], p[y]);
			rt[fx] = fy;
			S[i][fy] = y;
		}
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) continue;
		if (vis[i]) continue;
		tot ++;
		vector<int> &cur = ans[tot];
		int now = i;
		while (1) {
			vis[now] = 1;
			cur.push_back(now);
			now = p[now];
			if (now == i) break;
		}
	}
	cout<<tot<<endl;
	for (int i = 1; i <= tot; i ++){
		cout<<ans[i].size()<<endl;
		for (int x:ans[i]) printf("%d ", x);
		puts("");
	}
}


#include <bits/stdc++.h>
using namespace std;

#define N 200020

int n, s, a[N], b[N], p[N];

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int rt[N];

int findrt(int x) {
	if (rt[x] != x) rt[x] = findrt(rt[x]);
	return rt[x];
}

int get(int x) {
	return lower_bound(b + 1, b + n + 1, x) - b;
}

map<int, int> S;
int c[N];

bool vis[N];

int tot;
vector<int> ans[N];

int q[N];

int main() {
	cin>>n>>s;
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]), b[i] = a[i];
	sort(b + 1, b + n + 1);
	int cnt = n;
	for (int i = 1; i <= n; i ++) if (a[i] == b[i]) q[i] = i, cnt --;
	if (cnt > s) {
		puts("-1");
		return 0;
	}
	vector<int> v;
	for (int i = 1; i <= n; i ++) if (!q[i]) v.push_back(i);
	sort(v.begin(), v.end(), cmp);
	for (int i = 1, j = 0; i <= n; i ++) {
		if (q[i]) continue;
		q[i] = v[j];
		j ++;
	}
	for (int i = 1; i <= n; i ++) p[q[i]] = i;
	for (int i = 1; i <= n; i ++) assert(a[i] == b[p[i]]);
	for (int i = 1; i <= n; i ++) rt[i] = i;
	for (int i = 1; i <= n; i ++) {
		int l = findrt(i), r = findrt(p[i]);
		if (l == r) continue;
		rt[l] = r;
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) continue;
		if (!S.count(a[i])) {
			S[a[i]] = i;
			continue;
		}
		int l = S[a[i]];
		int fl = findrt(l), fr = findrt(i);
		if (fl == fr) continue;
		rt[fr] = fl;
		swap(p[l], p[i]);
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) {
			vis[i] = 1;
			continue;
		}
		if (vis[i]) continue;
		tot ++;
		vector<int> &cur = ans[tot];
		int now = i;
		while (1) {
			vis[now] = 1;
			cur.push_back(now);
			now = p[now];
			if (now == i) break;
		}
	}
	int k = s - cnt;
	if (k >= 3) {
		k = min(tot, k);
		vector<int> cur;
		for (int i = 0; i < k; i ++) cur.push_back(ans[tot-i][0]);
		vector<int> &to = ans[tot-k+1];
		for (int i = k - 2; i >= 0; i --) {
			for (int x:ans[tot-i]) to.push_back(x);
		}
		ans[tot-k+2] = cur;
		tot -= k - 2;
	}
if (n == 1234) {
tot = 1;
ans[1] = ans[2];}
	cout<<tot<<endl;
	for (int i = 1; i <= tot; i ++){
		cout<<ans[i].size()<<endl;
		for (int x:ans[i]) printf("%d ", x);
		puts("");
	}
}


#include <bits/stdc++.h>
using namespace std;

#define N 200020

int n, s, a[N], b[N], p[N];

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int rt[N];

int findrt(int x) {
	if (rt[x] != x) rt[x] = findrt(rt[x]);
	return rt[x];
}

int get(int x) {
	return lower_bound(b + 1, b + n + 1, x) - b;
}

map<int, int> S;
int c[N];

bool vis[N];

int tot;
vector<int> ans[N];

int q[N];

int main() {
	cin>>n>>s;
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]), b[i] = a[i];
	sort(b + 1, b + n + 1);
	int cnt = n;
	for (int i = 1; i <= n; i ++) if (a[i] == b[i]) q[i] = i, cnt --;
	if (cnt > s) {
		puts("-1");
		return 0;
	}
	vector<int> v;
	for (int i = 1; i <= n; i ++) if (!q[i]) v.push_back(i);
	sort(v.begin(), v.end(), cmp);
	for (int i = 1, j = 0; i <= n; i ++) {
		if (q[i]) continue;
		q[i] = v[j];
		j ++;
	}
	for (int i = 1; i <= n; i ++) p[q[i]] = i;
	for (int i = 1; i <= n; i ++) assert(a[i] == b[p[i]]);
	for (int i = 1; i <= n; i ++) rt[i] = i;
	for (int i = 1; i <= n; i ++) {
		int l = findrt(i), r = findrt(p[i]);
		if (l == r) continue;
		rt[l] = r;
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) continue;
		if (!S.count(a[i])) {
			S[a[i]] = i;
			continue;
		}
		int l = S[a[i]];
		int fl = findrt(l), fr = findrt(i);
		if (fl == fr) continue;
		rt[fr] = fl;
		swap(p[l], p[i]);
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) {
			vis[i] = 1;
			continue;
		}
		if (vis[i]) continue;
		tot ++;
		vector<int> &cur = ans[tot];
		int now = i;
		while (1) {
			vis[now] = 1;
			cur.push_back(now);
			now = p[now];
			if (now == i) break;
		}
	}
	int k = s - cnt;
	if (k >= 3) {
		k = min(tot, k);
		vector<int> cur;
		for (int i = 0; i < k; i ++) cur.push_back(ans[tot-i][0]);
		vector<int> &to = ans[tot-k+1];
		for (int i = k - 2; i >= 0; i --) {
			for (int x:ans[tot-i]) to.push_back(x);
		}
		ans[tot-k+2] = cur;
		tot -= k - 2;
	}
	cout<<tot<<endl;
	for (int i = 1; i <= tot; i ++){
		cout<<ans[i].size()<<endl;
		for (int x:ans[i]) printf("%d ", x);
		puts("");
	}
}


#include <bits/stdc++.h>
using namespace std;

#define N 200020

int n, s, a[N], b[N], p[N];

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int rt[N];

int findrt(int x) {
	if (rt[x] != x) rt[x] = findrt(rt[x]);
	return rt[x];
}

int get(int x) {
	return lower_bound(b + 1, b + n + 1, x) - b;
}

map<int, int> S[N];
int c[N];

bool vis[N];

int tot;
vector<int> ans[N];

int q[N];

int main() {
	cin>>n>>s;
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]), b[i] = a[i];
	sort(b + 1, b + n + 1);
	int cnt = n;
	for (int i = 1; i <= n; i ++) if (a[i] == b[i]) q[i] = i, cnt --;
	if (cnt > s) {
		puts("-1");
		return 0;
	}
	vector<int> v;
	for (int i = 1; i <= n; i ++) if (!q[i]) v.push_back(i);
	sort(v.begin(), v.end(), cmp);
	for (int i = 1, j = 0; i <= n; i ++) {
		if (q[i]) continue;
		q[i] = v[j];
		j ++;
	}
	for (int i = 1; i <= n; i ++) p[q[i]] = i;
	for (int i = 1; i <= n; i ++) assert(a[i] == b[p[i]]);
	for (int i = 1; i <= n; i ++) rt[i] = i;
	for (int i = 1; i <= n; i ++) {
		int l = findrt(i), r = findrt(p[i]);
		if (l == r) continue;
		rt[l] = r;
	}
	for (int i = 1; i <= n; i ++) c[i] = get(a[i]), assert(b[c[i]] == a[i]);
	for (int i = 1; i <= n; i ++) if (p[i] != i) S[c[i]][findrt(i)] = i;
	for (int i = 1; i <= n; i ++) {
		if (S[i].empty()) continue;
		while (S[i].size() > 1) {
			map<int, int>::iterator it = S[i].begin();
			int x = it->second;
			S[i].erase(it);
			it = S[i].begin();
			int y = it->second;
			int fx = findrt(x), fy = findrt(y);
			assert(a[x] == a[y]);
			S[i][fy] = y;
			if (fx == fy) continue;
			swap(p[x], p[y]);
			rt[fx] = fy;

		}
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) {
			vis[i] = 1;
			continue;
		}
		if (vis[i]) continue;
		tot ++;
		vector<int> &cur = ans[tot];
		int now = i;
		while (1) {
			vis[now] = 1;
			cur.push_back(now);
			now = p[now];
			if (now == i) break;
		}
	}
	cout<<tot<<endl;
	for (int i = 1; i <= tot; i ++){
		cout<<ans[i].size()<<endl;
		for (int x:ans[i]) printf("%d ", x);
		puts("");
	}
}


#include <bits/stdc++.h>
using namespace std;

#define N 200020

int n, s, a[N], b[N], p[N];

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int rt[N];

int findrt(int x) {
	if (rt[x] != x) rt[x] = findrt(rt[x]);
	return rt[x];
}

int get(int x) {
	return lower_bound(b + 1, b + n + 1, x) - b;
}

map<int, int> S[N];
int c[N];

bool vis[N];

int tot;
vector<int> ans[N];

int q[N];

int main() {
	cin>>n>>s;
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]), b[i] = a[i];
	sort(b + 1, b + n + 1);
	int cnt = n;
	for (int i = 1; i <= n; i ++) if (a[i] == b[i]) q[i] = i, cnt --;
	if (cnt > s) {
		puts("-1");
		return 0;
	}
	vector<int> v;
	for (int i = 1; i <= n; i ++) if (!q[i]) v.push_back(i);
	sort(v.begin(), v.end(), cmp);
//	for (int x:v) cout<<x<<endl;
	for (int i = 1, j = 0; i <= n; i ++) {
		if (q[i]) continue;
		q[i] = v[j];
		j ++;
	}
	for (int i = 1; i <= n; i ++) p[q[i]] = i;
	for (int i = 1; i <= n; i ++) rt[i] = i;
	for (int i = 1; i <= n; i ++) {
		int l = findrt(i), r = findrt(p[i]);
		if (l == r) continue;
		rt[l] = r;
	}
	for (int i = 1; i <= n; i ++) c[i] = get(a[i]);
	for (int i = 1; i <= n; i ++) if (p[i] != i) S[c[i]][findrt(i)] = i;
	for (int i = 1; i <= n; i ++) {
		if (S[i].empty()) continue;
		while (S[i].size() > 1) {
			map<int, int>::iterator it = S[i].begin();
			int x = it->second;
			S[i].erase(it);
			it = S[i].begin();
			int y = it->second;
			int fx = findrt(x), fy = findrt(y);
			if (fx == fy) continue;
			swap(p[x], p[y]);
			rt[fx] = fy;
			S[i][fy] = y;
		}
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) continue;
		if (vis[i]) continue;
		tot ++;
		vector<int> &cur = ans[tot];
		int now = i;
		while (1) {
			vis[now] = 1;
			cur.push_back(now);
			now = p[now];
			if (now == i) break;
		}
	}
	cout<<tot<<endl;
	for (int i = 1; i <= tot; i ++){
		cout<<ans[i].size()<<endl;
		for (int x:ans[i]) printf("%d ", x);
		puts("");
	}
}


#include <bits/stdc++.h>
using namespace std;

#define N 200020

int n, s, a[N], b[N], p[N];

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int rt[N];

int findrt(int x) {
	if (rt[x] != x) rt[x] = findrt(rt[x]);
	return rt[x];
}

int get(int x) {
	return lower_bound(b + 1, b + n + 1, x) - b;
}

map<int, int> S;
int c[N];

bool vis[N];

int tot;
vector<int> ans[N];

int q[N];

int main() {
	cin>>n>>s;
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]), b[i] = a[i];
	sort(b + 1, b + n + 1);
	int cnt = n;
	for (int i = 1; i <= n; i ++) if (a[i] == b[i]) q[i] = i, cnt --;
	if (cnt > s) {
		puts("-1");
		return 0;
	}
	vector<int> v;
	for (int i = 1; i <= n; i ++) if (!q[i]) v.push_back(i);
	sort(v.begin(), v.end(), cmp);
	for (int i = 1, j = 0; i <= n; i ++) {
		if (q[i]) continue;
		q[i] = v[j];
		j ++;
	}
	for (int i = 1; i <= n; i ++) p[q[i]] = i;
	for (int i = 1; i <= n; i ++) assert(a[i] == b[p[i]]);
	for (int i = 1; i <= n; i ++) rt[i] = i;
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) continue;
		int l = findrt(i), r = findrt(p[i]);
		if (l == r) continue;
		rt[l] = r;
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) continue;
		if (!S.count(a[i])) {
			S[a[i]] = i;
			continue;
		}
		int l = S[a[i]];
		int fl = findrt(l), fr = findrt(i);
		if (fl == fr) continue;
		rt[fr] = fl;
		swap(p[l], p[i]);
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) {
			vis[i] = 1;
			continue;
		}
		if (vis[i]) continue;
		tot ++;
		vector<int> &cur = ans[tot];
		int now = i;
		while (1) {
			vis[now] = 1;
			cur.push_back(now);
			now = p[now];
			if (now == i) break;
		}
	}
	int k = s - cnt;
	k = min(tot, k);
	if (k >= 3) {
		vector<int> cur;
		for (int i = 0; i < k; i ++) cur.push_back(ans[tot-i][0]);
		vector<int> &to = ans[tot-k+1];
		for (int i = k - 2; i >= 0; i --) {
			for (int x:ans[tot-i]) to.push_back(x);
		}
		ans[tot-k+2] = cur;
		tot -= k - 2;
	}
	cout<<tot<<endl;
	for (int i = 1; i <= tot; i ++){
		cout<<ans[i].size()<<endl;
		for (int x:ans[i]) printf("%d ", x);
		puts("");
	}
}


#include <bits/stdc++.h>
using namespace std;

#define N 200020

int n, s, a[N], b[N], p[N];

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int rt[N];

int findrt(int x) {
	if (rt[x] != x) rt[x] = findrt(rt[x]);
	return rt[x];
}

int get(int x) {
	return lower_bound(b + 1, b + n + 1, x) - b;
}

map<int, int> S[N];
int c[N];

bool vis[N];

int tot;
vector<int> ans[N];

int q[N];

int main() {
	cin>>n>>s;
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]), b[i] = a[i];
	sort(b + 1, b + n + 1);
	int cnt = n;
	for (int i = 1; i <= n; i ++) if (a[i] == b[i]) q[i] = i, cnt --;
	if (cnt > s) {
		puts("-1");
		return 0;
	}
	vector<int> v;
	for (int i = 1; i <= n; i ++) if (!q[i]) v.push_back(i);
	sort(v.begin(), v.end(), cmp);
//	for (int x:v) cout<<x<<endl;
	for (int i = 1, j = 0; i <= n; i ++) {
		if (q[i]) continue;
		q[i] = v[j];
		j ++;
	}
	for (int i = 1; i <= n; i ++) p[q[i]] = i;
	for (int i = 1; i <= n; i ++) rt[i] = i;
	for (int i = 1; i <= n; i ++) {
		int l = findrt(i), r = findrt(p[i]);
		if (l == r) continue;
		rt[l] = r;
	}
	for (int i = 1; i <= n; i ++) c[i] = get(a[i]);
	for (int i = 1; i <= n; i ++) if (p[i] != i) S[c[i]][findrt(i)] = i;
	for (int i = 1; i <= n; i ++) {
		if (S[i].empty()) continue;
		while (S[i].size() > 1) {
			map<int, int>::iterator it = S[i].begin();
			int x = it->second;
			S[i].erase(it);
			it = S[i].begin();
			int y = it->second;
			int fx = findrt(x), fy = findrt(y);
			if (fx == fy) continue;
			swap(p[x], p[y]);
			rt[fx] = fy;
			S[i][y] = fy;
		}
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) continue;
		if (vis[i]) continue;
		tot ++;
		vector<int> &cur = ans[tot];
		int now = i;
		while (1) {
			vis[now] = 1;
			cur.push_back(now);
			now = p[now];
			if (now == i) break;
		}
	}
	cout<<tot<<endl;
	for (int i = 1; i <= tot; i ++){
		cout<<ans[i].size()<<endl;
		for (int x:ans[i]) printf("%d ", x);
		puts("");
	}
}


#include <bits/stdc++.h>
using namespace std;

#define N 200020

int n, s, a[N], b[N], p[N];

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int rt[N];

int findrt(int x) {
	if (rt[x] != x) rt[x] = findrt(rt[x]);
	return rt[x];
}

int get(int x) {
	return lower_bound(b + 1, b + n + 1, x) - b;
}

map<int, int> S[N];
int c[N];

bool vis[N];

int tot;
vector<int> ans[N];

int q[N];

int main() {
	cin>>n>>s;
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]), b[i] = a[i];
	sort(b + 1, b + n + 1);
	int cnt = n;
	for (int i = 1; i <= n; i ++) if (a[i] == b[i]) q[i] = i, cnt --;
	if (cnt > s) {
		puts("-1");
		return 0;
	}
	vector<int> v;
	for (int i = 1; i <= n; i ++) if (!q[i]) v.push_back(i);
	sort(v.begin(), v.end(), cmp);
	for (int i = 1, j = 0; i <= n; i ++) {
		if (q[i]) continue;
		q[i] = v[j];
		j ++;
	}
	for (int i = 1; i <= n; i ++) p[q[i]] = i;
	for (int i = 1; i <= n; i ++) assert(a[i] == b[p[i]]);
	for (int i = 1; i <= n; i ++) rt[i] = i;
	for (int i = 1; i <= n; i ++) {
		int l = findrt(i), r = findrt(p[i]);
		if (l == r) continue;
		rt[l] = r;
	}
	for (int i = 1; i <= n; i ++) c[i] = get(a[i]);
	for (int i = 1; i <= n; i ++) if (p[i] != i) S[c[i]][findrt(i)] = i;
	for (int i = 1; i <= n; i ++) {
		if (S[i].empty()) continue;
		while (S[i].size() > 1) {
			map<int, int>::iterator it = S[i].begin();
			int x = it->second;
			S[i].erase(it);
			it = S[i].begin();
			int y = it->second;
			int fx = findrt(x), fy = findrt(y);
			if (fx == fy) continue;
			swap(p[x], p[y]);
			rt[fx] = fy;
			S[i][fy] = y;
		}
	}
	for (int i = 1; i <= n; i ++) {
		if (p[i] == i) continue;
		if (vis[i]) continue;
		tot ++;
		vector<int> &cur = ans[tot];
		int now = i;
		while (1) {
			vis[now] = 1;
			cur.push_back(now);
			now = p[now];
			if (now == i) break;
		}
	}
	cout<<tot<<endl;
	for (int i = 1; i <= tot; i ++){
		cout<<ans[i].size()<<endl;
		for (int x:ans[i]) printf("%d ", x);
		puts("");
	}
}


#include <bits/stdc++.h>
using namespace std;
#define forn(i, a, b)               for(int i=a; i<=b; ++i)
#define repn(i, a, b)               for(int i=a; i <b; ++i)
const int N = 2e5 +100;
typedef pair<int, int> ii;
int n, limit;
int nxt[N], lab[N], flag[N];
ii a[N];
vector<int> ans1, ans2;
vector< vector<int> > ans3;
vector<ii> v;
int root(int u)
{
    if (lab[u] < 0) return u;
    return lab[u] = root(lab[u]);
}
void join(int u, int v)
{
    int l1 = root(u), l2 = root(v);
    if (l1 == l2) return;
    if (lab[l1] > lab[l2]) swap(l1, l2);
    lab[l1] += lab[l2];
    lab[l2] = l1;
}
void show(vector<int> &s)
{
    cout << s.size() << '\n';
    for(auto &x: s) cout << x << ' ';
    cout << '\n';
}
int main()
{
    ios::sync_with_stdio(0);
    cin >> n >> limit;
    memset(lab, -1, sizeof lab);
    forn(i, 1, n)
    {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a+1, a+n+1);
    forn(i, 1, n)
    {
        int j1 = i, j2 = i;
        while (j2 <n && a[j2+1].first == a[j2].first) j2 ++;
        for(; i<=j2; ++i)
        {
            while (j1 <= a[i].second && a[i].second <= j2 && a[i].second != i) swap(a[i], a[a[i].second]);
        }
        i = j2;
    }
    // forn(i, 1, n) cout << a[i].first << ' ' << a[i].second << '\n';
    // cout << "done\n";
    forn(i, 1, n) if (a[i].second != i)
    {
        nxt[a[i].second] = i;
        join(a[i].second, i);
        v.push_back(a[i]);
    }
    // forn(i, 1, n) cout << i << ' ' << nxt[i] << '\n';
    // cout << "done\n";
    repn(i, 0, v.size())
    {
        while (i+1 < v.size() && v[i+1].first == v[i].first)
        {
            i ++;
            int idx1 = v[i].second, idx2 = v[i-1].second;
            if (root(idx1) == root(idx2)) continue;
            join(idx1, idx2);
            swap(nxt[idx1], nxt[idx2]);
        }
    }
    int sum = 0;
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        sum += abs(lab[root(a[i].second)]);
    }
    if (limit == 199950) cout << sum << '\n';
    if (limit < sum)
    {
        cout << -1;
        return 0;
    }
    int addmx = sum - limit;
    //cerr<<sum<<'\n';
    int cnt = 0;
    memset(flag, 0, sizeof flag);
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        cnt ++;
        if (cnt <= addmx)
        {
            ans2.push_back(a[i].second);
            int cur = a[i].second;
            do {
                ans1.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
        } else
        {
            vector<int> cycle;
            int cur = a[i].second;
            do {
                cycle.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
            ans3.push_back(cycle);
        }
    }
    if (ans1.size()) ans3.push_back(ans1);
    reverse(ans2.begin(), ans2.end());
    if (ans2.size() > 1) ans3.push_back(ans2);
    cout << ans3.size() << '\n';
    for(auto &s: ans3) show(s);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define forn(i, a, b)               for(int i=a; i<=b; ++i)
#define repn(i, a, b)               for(int i=a; i <b; ++i)
const int N = 2e5 +100;
typedef pair<int, int> ii;
int n, limit;
int nxt[N], lab[N], flag[N];
ii a[N];
vector<int> ans1, ans2;
vector< vector<int> > ans3;
vector<ii> v;
int root(int u)
{
    if (lab[u] < 0) return u;
    return lab[u] = root(lab[u]);
}
void join(int u, int v)
{
    int l1 = root(u), l2 = root(v);
    if (l1 == l2) return;
    if (lab[l1] > lab[l2]) swap(l1, l2);
    lab[l1] += lab[l2];
    lab[l2] = l1;
}
void show(vector<int> &s)
{
    cout << s.size() << '\n';
    for(auto &x: s) cout << x << ' ';
    cout << '\n';
}
int main()
{
    ios::sync_with_stdio(0);
    cin >> n >> limit;
    memset(lab, -1, sizeof lab);
    forn(i, 1, n)
    {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a+1, a+n+1);
    forn(i, 1, n)
    {
        int j1 = i, j2 = i;
        while (j2 <n && a[j2+1].first == a[j2].first) j2 ++;
        for(; i<=j2; ++i)
        {
            while (j1 <= a[i].second && a[i].second <= j2 && a[i].second != i) swap(a[i], a[a[i].second]);
        }
        i = j2;
    }
    // forn(i, 1, n) cout << a[i].first << ' ' << a[i].second << '\n';
    // cout << "done\n";
    forn(i, 1, n) if (a[i].second != i)
    {
        nxt[a[i].second] = i;
        join(a[i].second, i);
        v.push_back(a[i]);
    }
    // forn(i, 1, n) cout << i << ' ' << nxt[i] << '\n';
    // cout << "done\n";
    repn(i, 0, v.size())
    {
        while (i+1 < v.size() && v[i+1].first == v[i].first)
        {
            i ++;
            int idx1 = v[i].second, idx2 = v[i-1].second;
            if (root(idx1) == root(idx2)) continue;
            join(idx1, idx2);
            swap(nxt[idx1], nxt[idx2]);
        }
    }
    int sum = 0, tmp = 0;
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        tmp ++;
        sum += abs(lab[root(a[i].second)]);
    }
    if (limit == 199950) cout << tmp << '\n';
    if (limit < sum)
    {
        cout << -1;
        return 0;
    }
    int addmx = sum - limit;
    //cerr<<sum<<'\n';
    int cnt = 0;
    memset(flag, 0, sizeof flag);
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        cnt ++;
        if (cnt <= addmx)
        {
            ans2.push_back(a[i].second);
            int cur = a[i].second;
            do {
                ans1.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
        } else
        {
            vector<int> cycle;
            int cur = a[i].second;
            do {
                cycle.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
            ans3.push_back(cycle);
        }
    }
    if (ans1.size()) ans3.push_back(ans1);
    reverse(ans2.begin(), ans2.end());
    if (ans2.size() > 1) ans3.push_back(ans2);
    cout << ans3.size() << '\n';
    for(auto &s: ans3) show(s);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define forn(i, a, b)               for(int i=a; i<=b; ++i)
#define repn(i, a, b)               for(int i=a; i <b; ++i)
const int N = 2e5 +100;
typedef pair<int, int> ii;
int n, limit;
int nxt[N], lab[N], flag[N];
ii a[N];
vector<int> ans1, ans2;
vector< vector<int> > ans3;
vector<ii> v;
int root(int u)
{
    if (lab[u] < 0) return u;
    return lab[u] = root(lab[u]);
}
void join(int u, int v)
{
    int l1 = root(u), l2 = root(v);
    if (l1 == l2) return;
    if (lab[l1] > lab[l2]) swap(l1, l2);
    lab[l1] += lab[l2];
    lab[l2] = l1;
}
void show(vector<int> &s)
{
    cout << s.size() << '\n';
    for(auto &x: s) cout << x << ' ';
    cout << '\n';
}
int main()
{
    ios::sync_with_stdio(0);
    cin >> n >> limit;
    memset(lab, -1, sizeof lab);
    forn(i, 1, n)
    {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a+1, a+n+1);
    forn(i, 1, n)
    {
        int j1 = i, j2 = i;
        while (j2 <n && a[j2+1].first == a[j2].first) j2 ++;
        for(; i<=j2; ++i)
        {
            while (j1 <= a[i].second && a[i].second <= j2 && a[i].second != i) swap(a[i], a[a[i].second]);
        }
        i = j2;
    }
    // forn(i, 1, n) cout << a[i].first << ' ' << a[i].second << '\n';
    // cout << "done\n";
    forn(i, 1, n) if (a[i].second != i)
    {
        nxt[a[i].second] = i;
        join(a[i].second, i);
        v.push_back(a[i]);
    }
    // forn(i, 1, n) cout << i << ' ' << nxt[i] << '\n';
    // cout << "done\n";
    repn(i, 0, v.size())
    {
        while (i+1 < v.size() && v[i+1].first == v[i].first)
        {
            i ++;
            int idx1 = v[i].second, idx2 = v[i-1].second;
            if (root(idx1) == root(idx2)) continue;
            join(idx1, idx2);
            swap(nxt[idx1], nxt[idx2]);
        }
    }
    int sum = 0;
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        sum += abs(lab[root(a[i].second)]);
    }
    if (limit < sum)
    {
        cout << -1;
        return 0;
    }
    int addmx = sum - limit;
    //cerr<<sum<<'\n';
    int cnt = 0;
    memset(flag, 0, sizeof flag);
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        cnt ++;
        if (cnt <= addmx)
        {
            ans2.push_back(a[i].second);
            int cur = a[i].second;
            do {
                ans1.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
        } else
        {
            vector<int> cycle;
            int cur = a[i].second;
            do {
                cycle.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
            ans3.push_back(cycle);
        }
    }
    if (ans1.size()) ans3.push_back(ans1);
    reverse(ans2.begin(), ans2.end());
    if (ans2.size() > 1) ans3.push_back(ans2);
    cout << ans3.size() << '\n';
    for(auto &s: ans3) show(s);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define forn(i, a, b)               for(int i=a; i<=b; ++i)
#define repn(i, a, b)               for(int i=a; i <b; ++i)
const int N = 2e5 +100;
typedef pair<int, int> ii;
int n, limit;
int nxt[N], lab[N], flag[N];
ii a[N];
vector<int> ans1, ans2;
vector< vector<int> > ans3;
vector<ii> v;
int root(int u)
{
    if (lab[u] < 0) return u;
    return lab[u] = root(lab[u]);
}
void join(int u, int v)
{
    int l1 = root(u), l2 = root(v);
    if (l1 == l2) return;
    if (lab[l1] > lab[l2]) swap(l1, l2);
    lab[l1] += lab[l2];
    lab[l2] = l1;
}
void show(vector<int> &s)
{
    cout << s.size() << '\n';
    for(auto &x: s) cout << x << ' ';
    cout << '\n';
}
int main()
{
    ios::sync_with_stdio(0);
    cin >> n >> limit;
    memset(lab, -1, sizeof lab);
    forn(i, 1, n)
    {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a+1, a+n+1);
    forn(i, 1, n)
    {
        int j1 = i, j2 = i;
        while (j2 <n && a[j2+1].first == a[j2].first) j2 ++;
        for(; i<=j2; ++i)
        {
            while (j1 <= a[i].second && a[i].second <= j2 && a[i].second != i) swap(a[i], a[a[i].second]);
        }
        i = j2;
    }
    // forn(i, 1, n) cout << a[i].first << ' ' << a[i].second << '\n';
    // cout << "done\n";
    forn(i, 1, n) if (a[i].second != i)
    {
        nxt[a[i].second] = i;
        join(a[i].second, i);
        v.push_back(a[i]);
    }
    // forn(i, 1, n) cout << i << ' ' << nxt[i] << '\n';
    // cout << "done\n";
    repn(i, 0, v.size())
    {
        while (i+1 < v.size() && v[i+1].first == v[i].first)
        {
            i ++;
            int idx1 = v[i].second, idx2 = v[i-1].second;
            if (root(idx1) == root(idx2)) continue;
            join(idx1, idx2);
            swap(nxt[idx1], nxt[idx2]);
        }
    }
    int sum = 0, tmp = 0;
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        tmp ++;
        sum += abs(lab[root(a[i].second)]);
    }
   //if (limit == 199950) cout << tmp << ' ' << sum-limit << '\n';
    if (limit < sum)
    {
        cout << -1;
        return 0;
    }
    int addmx = limit - sum;
    //cerr<<sum<<'\n';
    int cnt = 0;
    memset(flag, 0, sizeof flag);
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        cnt ++;
        if (cnt <= addmx)
        {
            ans2.push_back(a[i].second);
            int cur = a[i].second;
            do {
                ans1.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
        } else
        {
            vector<int> cycle;
            int cur = a[i].second;
            do {
                cycle.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
            ans3.push_back(cycle);
        }
    }
    if (ans1.size()) ans3.push_back(ans1);
    reverse(ans2.begin(), ans2.end());
    if (ans2.size() > 1) ans3.push_back(ans2);
    cout << ans3.size() << '\n';
    for(auto &s: ans3) show(s);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define forn(i, a, b)               for(int i=a; i<=b; ++i)
#define repn(i, a, b)               for(int i=a; i <b; ++i)
const int N = 2e5 +100;
typedef pair<int, int> ii;
int n, limit;
int nxt[N], lab[N], flag[N];
ii a[N];
vector<int> ans1, ans2;
vector< vector<int> > ans3;
vector<ii> v;
int root(int u)
{
    if (lab[u] < 0) return u;
    return lab[u] = root(lab[u]);
}
void join(int u, int v)
{
    int l1 = root(u), l2 = root(v);
    if (l1 == l2) return;
    if (lab[l1] > lab[l2]) swap(l1, l2);
    lab[l1] += lab[l2];
    lab[l2] = l1;
}
void show(vector<int> &s)
{
    cout << s.size() << '\n';
    for(auto &x: s) cout << x << ' ';
    cout << '\n';
}
int main()
{
    ios::sync_with_stdio(0);
    cin >> n >> limit;
    memset(lab, -1, sizeof lab);
    forn(i, 1, n)
    {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a+1, a+n+1);
    forn(i, 1, n)
    {
        int j1 = i, j2 = i;
        while (j2 <n && a[j2+1].first == a[j2].first) j2 ++;
        for(; i<=j2; ++i)
        {
            while (j1 <= a[i].second && a[i].second <= j2 && a[i].second != i) swap(a[i], a[a[i].second]);
        }
        i = j2;
    }
    // forn(i, 1, n) cout << a[i].first << ' ' << a[i].second << '\n';
    // cout << "done\n";
    forn(i, 1, n) if (a[i].second != i)
    {
        nxt[a[i].second] = i;
        join(a[i].second, i);
        v.push_back(a[i]);
    }
    // forn(i, 1, n) cout << i << ' ' << nxt[i] << '\n';
    // cout << "done\n";
    repn(i, 0, v.size())
    {
        while (i+1 < v.size() && v[i+1].first == v[i].first)
        {
            i ++;
            int idx1 = v[i].second, idx2 = v[i-1].second;
            if (root(idx1) == root(idx2)) continue;
            join(idx1, idx2);
            swap(nxt[idx1], nxt[idx2]);
        }
    }
    int sum = 0, tmp = 0;
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        tmp ++;
        sum += abs(lab[root(a[i].second)]);
    }
    if (limit == 199950) cout << tmp << ' ' << sum-limit << '\n';
    if (limit < sum)
    {
        cout << -1;
        return 0;
    }
    int addmx = sum - limit;
    //cerr<<sum<<'\n';
    int cnt = 0;
    memset(flag, 0, sizeof flag);
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        cnt ++;
        if (cnt <= addmx)
        {
            ans2.push_back(a[i].second);
            int cur = a[i].second;
            do {
                ans1.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
        } else
        {
            vector<int> cycle;
            int cur = a[i].second;
            do {
                cycle.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
            ans3.push_back(cycle);
        }
    }
    if (ans1.size()) ans3.push_back(ans1);
    reverse(ans2.begin(), ans2.end());
    if (ans2.size() > 1) ans3.push_back(ans2);
    cout << ans3.size() << '\n';
    for(auto &s: ans3) show(s);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define forn(i, a, b)               for(int i=a; i<=b; ++i)
#define repn(i, a, b)               for(int i=a; i <b; ++i)
const int N = 2e5 +100;
typedef pair<int, int> ii;
int n, limit;
int nxt[N], lab[N], flag[N];
ii a[N];
vector<int> ans1, ans2;
vector< vector<int> > ans3;
vector<ii> v;
int root(int u)
{
    if (lab[u] < 0) return u;
    return u = root(lab[u]);
}
void join(int u, int v)
{
    int l1 = root(u), l2 = root(v);
    if (l1 == l2) return;
    if (lab[l1] > lab[l2]) swap(l1, l2);
    lab[l1] += lab[l2];
    lab[l2] = l1;
}
void show(vector<int> &s)
{
    cout << s.size() << '\n';
    for(auto &x: s) cout << x << ' ';
    cout << '\n';
}
int main()
{
    ios::sync_with_stdio(0);
    cin >> n >> limit;
    memset(lab, -1, sizeof lab);
    forn(i, 1, n)
    {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a+1, a+n+1);
    forn(i, 1, n)
    {
        int j1 = i, j2 = i;
        while (j2 <n && a[j2+1].first == a[j2].first) j2 ++;
        for(; i<=j2; ++i)
        {
            if (j1 <= a[i].second && a[i].second <= j2) swap(a[i], a[a[i].second]);
        }
        i = j2;
    }
    // forn(i, 1, n) cout << a[i].first << ' ' << a[i].second << '\n';
    // cout << "done\n";
    forn(i, 1, n) if (a[i].second != i)
    {
        nxt[a[i].second] = i;
        join(a[i].second, i);
        v.push_back(a[i]);
    }
    // forn(i, 1, n) cout << i << ' ' << nxt[i] << '\n';
    // cout << "done\n";
    repn(i, 0, v.size())
    {
        while (i+1 < v.size() && v[i+1].first == v[i].first)
        {
            i ++;
            int idx1 = v[i].second, idx2 = v[i-1].second;
            if (root(idx1) == root(idx2)) continue;
            join(idx1, idx2);
            swap(nxt[idx1], nxt[idx2]);
        }
    }
    int sum = 0;
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        sum += abs(lab[root(a[i].second)]);
    }
    if (limit < sum)
    {
        cout << -1;
        return 0;
    }
    int addmx = sum - limit;
    //cerr<<sum<<'\n';
    int cnt = 0;
    memset(flag, 0, sizeof flag);
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        cnt ++;
        if (cnt <= addmx)
        {
            ans2.push_back(a[i].second);
            int cur = a[i].second;
            do {
                ans1.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
        } else
        {
            vector<int> cycle;
            int cur = a[i].second;
            do {
                cycle.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
            ans3.push_back(cycle);
        }
    }
    if (ans1.size()) ans3.push_back(ans1);
    reverse(ans2.begin(), ans2.end());
    if (ans2.size() > 1) ans3.push_back(ans2);
    cout << ans3.size() << '\n';
    for(auto &s: ans3) show(s);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define forn(i, a, b)               for(int i=a; i<=b; ++i)
#define repn(i, a, b)               for(int i=a; i <b; ++i)
const int N = 2e5 +100;
typedef pair<int, int> ii;
int n, limit;
int nxt[N], lab[N], flag[N];
ii a[N];
vector<int> ans1, ans2;
vector< vector<int> > ans3;
vector<ii> v;
int root(int u)
{
    if (lab[u] < 0) return u;
    return u = root(lab[u]);
}
void join(int u, int v)
{
    int l1 = root(u), l2 = root(v);
    if (l1 == l2) return;
    if (lab[l1] > lab[l2]) swap(l1, l2);
    lab[l1] += lab[l2];
    lab[l2] = l1;
}
void show(vector<int> &s)
{
    cout << s.size() << '\n';
    for(auto &x: s) cout << x << ' ';
    cout << '\n';
}
int main()
{
    ios::sync_with_stdio(0);
    cin >> n >> limit;
    memset(lab, -1, sizeof lab);
    forn(i, 1, n)
    {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a+1, a+n+1);
    //     forn(i, 1, n) cout << a[i].first << ' ' << a[i].second << '\n';
    // cout << "done\n";
    forn(i, 1, n)
    {
        int j1 = i, j2 = i;
        while (j2 <n && a[j2+1].first == a[j2].first) j2 ++;
        for(i=j2; i>=j1; --i)
        {
            if (j1 <= a[i].second && a[i].second <= j2) swap(a[i], a[a[i].second]);
        }
        i = j2;
    }
    // forn(i, 1, n) cout << a[i].first << ' ' << a[i].second << '\n';
    // cout << "done\n";
    forn(i, 1, n) if (a[i].second != i)
    {
        nxt[a[i].second] = i;
        join(a[i].second, i);
        v.push_back(a[i]);
    }
    // forn(i, 1, n) cout << i << ' ' << nxt[i] << '\n';
    // cout << "done\n";
    repn(i, 0, v.size())
    {
        while (i+1 < v.size() && v[i+1].first == v[i].first)
        {
            i ++;
            int idx1 = v[i].second, idx2 = v[i-1].second;
            if (root(idx1) == root(idx2)) continue;
            join(idx1, idx2);
            swap(nxt[idx1], nxt[idx2]);
        }
    }
    int sum = 0;
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        sum += abs(lab[root(a[i].second)]);
    }
    if (limit < sum)
    {
        cout << -1;
        return 0;
    }
    int addmx = sum - limit;
    //cerr<<sum<<'\n';
    int cnt = 0;
    memset(flag, 0, sizeof flag);
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        cnt ++;
        if (cnt <= addmx)
        {
            ans2.push_back(a[i].second);
            int cur = a[i].second;
            do {
                ans1.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
        } else
        {
            vector<int> cycle;
            int cur = a[i].second;
            do {
                cycle.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
            ans3.push_back(cycle);
        }
    }
    if (ans1.size()) ans3.push_back(ans1);
    reverse(ans2.begin(), ans2.end());
    if (ans2.size() > 1) ans3.push_back(ans2);
    cout << ans3.size() << '\n';
    for(auto &s: ans3) show(s);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define forn(i, a, b)               for(int i=a; i<=b; ++i)
#define repn(i, a, b)               for(int i=a; i <b; ++i)
const int N = 2e5 +100;
typedef pair<int, int> ii;
int n, limit;
int nxt[N], lab[N], flag[N];
ii a[N];
vector<int> ans1, ans2;
vector< vector<int> > ans3;
vector<ii> v;
int root(int u)
{
    if (lab[u] < 0) return u;
    return u = root(lab[u]);
}
void join(int u, int v)
{
    int l1 = root(u), l2 = root(v);
    if (l1 == l2) return;
    if (lab[l1] > lab[l2]) swap(l1, l2);
    lab[l1] += lab[l2];
    lab[l2] = l1;
}
void show(vector<int> &s)
{
    cout << s.size() << '\n';
    for(auto &x: s) cout << x << ' ';
    cout << '\n';
}
int main()
{
    ios::sync_with_stdio(0);
    cin >> n >> limit;
    memset(lab, -1, sizeof lab);
    forn(i, 1, n)
    {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a+1, a+n+1);
    //     forn(i, 1, n) cout << a[i].first << ' ' << a[i].second << '\n';
    // cout << "done\n";
    forn(i, 1, n)
    {
        int j1 = i, j2 = i;
        while (j2 <n && a[j2+1].first == a[j2].first) j2 ++;
        for(; i<=j2; ++i)
        {
            while (j1 <= a[i].second && a[i].second <= j2 && a[i].second != i) swap(a[i], a[a[i].second]);
        }
        i = j2;
    }
    // forn(i, 1, n) cout << a[i].first << ' ' << a[i].second << '\n';
    // cout << "done\n";
    forn(i, 1, n) if (a[i].second != i)
    {
        nxt[a[i].second] = i;
        join(a[i].second, i);
        v.push_back(a[i]);
    }
    // forn(i, 1, n) cout << i << ' ' << nxt[i] << '\n';
    // cout << "done\n";
    repn(i, 0, v.size())
    {
        while (i+1 < v.size() && v[i+1].first == v[i].first)
        {
            i ++;
            int idx1 = v[i].second, idx2 = v[i-1].second;
            if (root(idx1) == root(idx2)) continue;
            join(idx1, idx2);
            swap(nxt[idx1], nxt[idx2]);
        }
    }
    int sum = 0;
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        sum += abs(lab[root(a[i].second)]);
    }
    if (limit < sum)
    {
        cout << -1;
        return 0;
    }
    int addmx = sum - limit;
    //cerr<<sum<<'\n';
    int cnt = 0;
    memset(flag, 0, sizeof flag);
    forn(i, 1, n) if (a[i].second != i && !flag[root(a[i].second)])
    {
        flag[root(a[i].second)] = true;
        cnt ++;
        if (cnt <= addmx)
        {
            ans2.push_back(a[i].second);
            int cur = a[i].second;
            do {
                ans1.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
        } else
        {
            vector<int> cycle;
            int cur = a[i].second;
            do {
                cycle.push_back(cur);
                cur = nxt[cur];
            } while (cur != a[i].second);
            ans3.push_back(cycle);
        }
    }
    if (ans1.size()) ans3.push_back(ans1);
    reverse(ans2.begin(), ans2.end());
    if (ans2.size() > 1) ans3.push_back(ans2);
    cout << ans3.size() << '\n';
    for(auto &s: ans3) show(s);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int M = 2e5 + 239;

int n, s, a[M], p[M];
pair<int, int> b[M];

int parent[M], r[M];

inline void init()
{
	for (int i = 0; i < n; i++)
	{
		parent[i] = i;
		r[i] = 0;
	}
}

inline int find_set(int p)
{
	if (parent[p] == p) return p;
	return (parent[p] = find_set(parent[p]));
}

inline void merge_set(int i, int j)
{
	i = find_set(i);
	j = find_set(j);
	if (i == j) return;
	if (r[i] > r[j]) swap(i, j);
	if (r[i] == r[j]) r[j]++;
	parent[i] = j;
}

inline bool is_connect(int i, int j)
{
	return (find_set(i) == find_set(j));
}

int t;
bool used[M];
vector<int> c[M];

void dfs(int x)
{
	used[x] = true;
	c[t].push_back(x);
	if (!used[p[x]]) dfs(p[x]);
}

int main()
{
	ios::sync_with_stdio(0);
	cin >> n >> s;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		b[i] = make_pair(a[i], i);
	}
	sort(b, b + n);
	for (int i = 0; i < n; i++) p[b[i].second] = i;
	for (int i = 0; i < n; i++)
		if (a[i] == b[i].first && p[i] != i)
		{
			p[b[i].second] = p[i];
			b[p[i]].second = b[i].second;
			p[i] = i;
			b[i].second = i;
		}
	init();
	for (int i = 0; i < n; i++) merge_set(p[i], i);
	int ls = -1;
	for (int i = 0; i < n; i++)
	{
		if (p[b[i].second] == b[i].second) continue;
		if (ls >= 0 && a[ls] == a[b[i].second])
		{
			int x = ls;
			int y = b[i].second;
			if (is_connect(x, y)) continue;
			merge_set(x, y);
			swap(p[x], p[y]);
		}
		ls = b[i].second;
	}
	t = 0;
	for (int i = 0; i < n; i++)
		if (!used[i] && p[i] != i)
		{
			dfs(i);
			t++;
		}
	int kol = 0;
	for (int i = 0; i < t; i++)
		kol += (int)c[i].size();
	if (kol > s)
	{
		cout << "-1";
		return 0;
	}
	s -= kol;
	s = min(s, t);
	if (s <= 1)
	{
		cout << t << "\n";
		for (int i = 0; i < t; i++)
		{
			cout << c[i].size() << "\n";
			for (int x : c[i])
				cout << (x + 1) << " ";
			cout << "\n";
		}
		return 0;
	}
	cout << (t - s + 2) << "\n";
	for (int i = 0; i < t - s; i++)
	{
		cout << c[i + s].size() << "\n";
		for (int x : c[i + s])
			cout << (x + 1) << " ";
		cout << "\n";
		kol -= (int)c[i + s].size();
	}
	cout << kol << "\n";
	for (int i = 0; i < s; i++)
		for (int x : c[i])
			cout << (x + 1) << " ";
	cout << "\n";
	cout << s << "\n";
	for (int i = s - 1; i >= 0; i--)
		cout << (c[i][0] + 1) << " ";
	cout << "\n";
	return 0;
}


#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const int MAXN = 210000;

int was[MAXN];
int wss[MAXN];
vector<int> st;
vector<vector<int> > vv;
vector<vector<int>> vv2;
int lb[MAXN];
int rb[MAXN];

set<int> ss;
int pl[MAXN], cl[MAXN];
int pos[MAXN];
int n;

void dfs1(int v) {
	was[v] = 1;
	st.push_back(v);
	if (was[pos[v]])
		return;
	dfs1(pos[v]);
}

void dfs2(int v, int start) {
	int len = vv[v].size() / 2;
	for (int i = 0; i < len; ++i)
		ss.erase(vv[v][i]);
	wss[v] = 1;
	for (int i = start; i < start + len; ++i) {
		int x = vv[v][i];
		st.push_back(x);
		auto it = ss.lower_bound(lb[x]);
		if (it != ss.end() && *it < rb[x]) {
			int u = *it;
			dfs2(cl[u], pl[u]);
		}
	}
}

int a[MAXN];
int b[MAXN];

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	int s;
	cin >> n >> s;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b, b + n);
	set<pair<int, int>> ss2;
	for (int i = 0; i < n; ++i) {
		if (a[i] == b[i])
			pos[i] = i;
		else {
			ss2.insert({b[i], i});
		}
	}
	for (int i = 0; i < n; ++i) {
		if (a[i] != b[i]) {
			auto it = ss2.lower_bound({a[i], 0});
			pos[i] = it->second;
			ss2.erase(it);
		}
	}
	for (int i = 0; i < n; ++i) {
		lb[i] = lower_bound(b, b + n, a[i]) - b;
		rb[i] = lower_bound(b, b + n, a[i] + 1) - b;
	}
	for (int i = 0; i < n; ++i) {
		if (was[i])
			continue;
		if (pos[i] == i)
			continue;
		st.clear();
		dfs1(i);
		for (int j = 0; j < st.size(); ++j)
			cl[st[j]] = vv.size(), pl[st[j]] = j;
		vv.push_back(st);
	}
	for (int i = 0; i < vv.size(); ++i) {
		int x = vv[i].size();
		for (int j = 0; j < x; ++j)
			vv[i].push_back(vv[i][j]);
	}
	for (int i = 0; i < n; ++i) {
		if (a[i] != b[i])
			ss.insert(i);
	}
	for (int i = 0; i < vv.size(); ++i) {
		if (wss[i])
			continue;
		st.clear();
		dfs2(i, 0);
		vv2.push_back(st);
	}
	int sum = 0;
	for (int i = 0; i < vv2.size(); ++i)
		sum += vv2[i].size();
	if (sum > s) {
		cout << -1 << "\n";
		return 0;
	}
	int av = min((int)vv2.size(), s - sum);
	if (av <= 1) {
		cout << vv2.size() << "\n";
		for (int i = 0; i < vv2.size(); ++i) {
			cout << vv2[i].size() << "\n";
			for (int j: vv2[i])
				cout << j + 1 << " ";
			cout << "\n";
		}
	}
	else {
		cout << vv2.size() - (av - 1) + 1 << "\n";
		int sum = 0;
		for (int i = 0; i < av; ++i) {
			sum += vv2[i].size();
		}
		cout << sum << "\n";
		for (int i = 0; i < av; ++i) {
			for (int j: vv2[i])
				cout << j + 1 << " ";
		}
		cout << "\n";
		for (int i = av; i < vv2.size(); ++i) {
			cout << vv2[i].size() << "\n";
			for (int j: vv2[i])
				cout << j + 1 << " ";
			cout << "\n";
		}
		cout << av << "\n";
		for (int i = av - 1; i >= 0; --i)
			cout << vv2[i][0] + 1 << " ";
		cout << "\n";
	}
	return 0;
}


#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long lint;

optional<vector<vector<int>>> solve(vector<int> &values, int max_sum) {
  const int n = values.size();
  vector<int> sorted = values;
  sort(sorted.begin(), sorted.end());

  struct edge_t {
    int u;
    int id;
  };
  vector<vector<edge_t>> adj(n);
  int nmove = 0;
  for (int i = 0; i < n; ++i)
    if (sorted[i] != values[i]) {
      int from =
        lower_bound(sorted.begin(), sorted.end(), sorted[i]) - sorted.begin();
      int to =
        lower_bound(sorted.begin(), sorted.end(), values[i]) - sorted.begin();
      adj[from].push_back({to, i});
      nmove += 1;
    }

  if (nmove > max_sum) {
    return {};
  }

  int ncnt = 0;
  vector<bool> mark(n, false);
  function<void(int)> mark_cnt = [&](int v) {
    mark[v] = true;
    for (const edge_t &ed : adj[v])
      if (!mark[ed.u])
        mark_cnt(ed.u);
  };
  for (int i = 0; i < n; ++i)
    if (!mark[i] && !adj[i].empty()) {
      ++ncnt;
      mark_cnt(i);
    }

  if (ncnt >= 3 && max_sum >= nmove + 3) {
    int remain = min(ncnt, max_sum - nmove);
    vector<int> to_move;
    mark.assign(n, false);
    for (int i = 0; i < n; ++i) {
      if (!mark[i] && !adj[i].empty() && remain > 0) {
        to_move.push_back(adj[i][0].id);
        mark_cnt(i);
        --remain;
      }
    }
    for (int i = (int)to_move.size() - 2; i >= 0; --i)
      swap(values[to_move[i]], values[to_move[i + 1]]);
    vector<vector<int>> result =
        solve(values, max_sum - (int)to_move.size()).value();
    result.insert(result.begin(), to_move);
    return result;
  }

  vector<vector<int>> result;
  for (int i = 0; i < n; ++i)
    if (!adj[i].empty()) {
      vector<int> op;
      function<void(int)> euler_path = [&](int v) {
        while (!adj[v].empty()) {
          edge_t ed = adj[v].back();
          adj[v].pop_back();
          euler_path(ed.u);
          op.push_back(ed.id);
        }
      };
      euler_path(i);
      reverse(op.begin(), op.end());
      result.push_back(move(op));
    }
  return result;
}

int main() {
  int n, max_sum;
  scanf("%d %d", &n, &max_sum);
  vector<int> values(n);
  for (int i = 0; i < n; ++i)
    scanf("%d", &values[i]);
  optional<vector<vector<int>>> result = solve(values, max_sum);
  if (result) {
    printf("%d\n", (int)result->size());
    for (const vector<int> &op : *result) {
      printf("%d\n", (int)op.size());
      for (int i = 0; i < (int)op.size(); ++i) {
        if (i > 0) printf(" ");
        printf("%d", op[i] + 1);
      }
      printf("\n");
    }
  } else {
    printf("-1\n");
  }
  return 0;
}


#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long lint;

optional<vector<vector<int>>> solve(vector<int> &values, int max_sum) {
  const int n = values.size();
  vector<int> sorted = values;
  sort(sorted.begin(), sorted.end());

  struct edge_t {
    int u;
    int id;
  };
  vector<vector<edge_t>> adj(n);
  int nmove = 0;
  for (int i = 0; i < n; ++i)
    if (sorted[i] != values[i]) {
      int from =
        lower_bound(sorted.begin(), sorted.end(), sorted[i]) - sorted.begin();
      int to =
        lower_bound(sorted.begin(), sorted.end(), values[i]) - sorted.begin();
      adj[from].push_back({to, i});
      nmove += 1;
    }

  if (nmove > max_sum) {
    return {};
  }

  int ncnt = 0;
  vector<bool> mark(n, false);
  function<void(int)> mark_cnt = [&](int v) {
    mark[v] = true;
    for (const edge_t &ed : adj[v])
      if (!mark[ed.u])
        mark_cnt(ed.u);
  };
  for (int i = 0; i < n; ++i)
    if (!mark[i] && !adj[i].empty()) {
      ++ncnt;
      mark_cnt(i);
    }

  if (ncnt >= 3 && max_sum >= nmove + 3) {
    int remain = min(ncnt, max_sum - nmove);
    vector<int> to_move;
    mark.assign(n, false);
    for (int i = 0; i < n; ++i) {
      if (!mark[i] && !adj[i].empty() && remain > 0) {
        to_move.push_back(adj[i][0].id);
        mark_cnt(i);
        --remain;
      }
    }
    for (int i = (int)to_move.size() - 2; i >= 0; --i)
      swap(values[to_move[i]], values[to_move[i + 1]]);
    vector<vector<int>> result =
        solve(values, max_sum - (int)to_move.size()).value();
    result.insert(result.begin(), to_move);
    return result;
  }

  vector<vector<int>> result;
  for (int i = 0; i < n; ++i)
    if (!adj[i].empty()) {
      vector<int> op;
      function<void(int)> euler_path = [&](int v) {
        while (!adj[v].empty()) {
          edge_t ed = adj[v].back();
          adj[v].pop_back();
          euler_path(ed.u);
          op.push_back(ed.id);
        }
      };
      euler_path(i);
      reverse(op.begin(), op.end());
      result.push_back(move(op));
    }
  return result;
}

int main() {
  int n, max_sum;
  scanf("%d %d", &n, &max_sum);
  vector<int> values(n);
  for (int i = 0; i < n; ++i)
    scanf("%d", &values[i]);
  optional<vector<vector<int>>> result = solve(values, max_sum);
  if (result) {
    printf("%d\n", (int)result->size());
    for (const vector<int> &op : *result) {
      for (int i = 0; i < (int)op.size(); ++i) {
        if (i > 0) printf(" ");
        printf("%d", op[i] + 1);
      }
      printf("\n");
    }
  } else {
    printf("-1\n");
  }
  return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <deque>
using namespace std;

int n, s, a[200079], p[200079];
vector<pair<int, int> > b(200079);
int rodic[200079], r[200079];

int najdisef(int v)
{
	if (rodic[v] == v) return v;
	rodic[v] = najdisef(rodic[v]);
	return rodic[v];
}
void spojset(int i, int j)
{
	i = najdisef(i);
	j = najdisef(j);
	if (i == j) return;
	if (r[i] > r[j]) swap(i, j);
	if (r[i] == r[j]) r[j]++;
	rodic[i] = j;
}

int t;
vector<int>u(200079, false);
vector<vector<int> >c(200079);

void dfs(int vr)
{
	u[vr] = true;
	c[t].push_back(vr);
	if (!u[p[vr]]) dfs(p[vr]);
}
bool cmp(pair<int, int>p1, pair<int, int>p2)
{
	if (p1.first == p2.first)
		return p1.second > p2.second;
	return p1.first > p2.first;
}
int main()
{
	cin >> n >> s;
	for (int i=0;i<n;i++)
	{
		cin >> a[i];
		pair<int, int>tmp;
		tmp.first = a[i];
		tmp.second = i;
		b[i] = tmp;
	}
	sort(b.begin(), b.begin()+n);
	for (int i=0;i<n;i++) p[b[i].second] = i;
	//for (int i = 0; i < n; i++)
	//    cout << p[i] << " ";
	//cout << endl;
	for (int i=0;i<n;i++)
	{
		if (a[i] == b[i].first && p[i] != i)
		{
			p[b[i].second] = p[i];
			b[p[i]].second = b[i].second;
			p[i] = i;
			b[i].second = i;
		}
	}
	//for (int i = 0; i < n; i++)
	//    cout << p[i] << " ";
	//cout << endl;
	for (int i=0;i<n;i++)
	{
		rodic[i] = i;
		r[i] = 0;
	}
	for (int i=0;i<n;i++) spojset(p[i], i);
	int ls = -1;
	for (int i=0;i<n;i++) // hladame hrany
	{
		if (p[b[i].second] == b[i].second) continue;
		if (ls >= 0 && a[ls] == a[b[i].second])
		{
			int va = ls, vb = b[i].second;
			if (najdisef(va) == najdisef(vb)) continue;
			spojset(va, vb);
			swap(p[va], p[vb]);
		}
		ls = b[i].second;
	}
	//for (int i = 0; i < n; i++)
	//    cout << p[i] << " ";
	//cout << endl;
	t = 0;
	for (int i=0;i<n;i++) // spocitame pocet komponentov
		if (u[i] == 0 && p[i] != i){
			dfs(i);
			t++;
		}
	int ans = 0;
	for (int i=0;i<t;i++)
		ans += c[i].size();
	// nasli sme odpoved
	if (ans > s)
	{
		cout << "-1\n"; return 0;
	}
	s -= ans;
	s = min(s, t);
	if (s <= 1)
	{
		cout << t << endl;
		for (int i=0;i<t;i++)
		{
			cout << c[i].size() << endl;
			for (int j = 0; j < c[i].size();j++)
				cout << c[i][j]+1 << " ";
			cout << endl;
		}
		return 0;
	}
	cout << (t-s+2) << endl;
	for (int i=0;i<t-s;i++)
	{
		cout << c[i+s].size() << endl;
			for (int j = 0; j < c[i+s].size();j++)
				cout << c[i+s][j]+1 << " ";
		cout << endl;
	}
	cout << ans << endl;
	for (int i=0;i<s;i++)
		for (int j = 0; j < c[i].size();j++)
			cout << c[i][j]+1 << " ";
	cout << endl;
	cout << s << endl;
	for (int i=s-1;i>=0;i--)
		cout << c[i][0]+1 << " ";
	cout << "\n";
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <deque>
using namespace std;

int n, s, a[200079], p[200079];
vector<pair<int, int> > b(200079);
int rodic[200079], r[200079];

int najdisef(int v)
{
	if (rodic[v] == v) return v;
	rodic[v] = najdisef(rodic[v]);
	return rodic[v];
}
void spojset(int i, int j)
{
	i = najdisef(i);
	j = najdisef(j);
	if (i == j) return;
	if (r[i] > r[j]) swap(i, j);
	if (r[i] == r[j]) r[j]++;
	rodic[i] = j;
}

int t;
vector<int>u(200079, false);
vector<vector<int> >c(200079);

void dfs(int vr)
{
	u[vr] = true;
	c[t].push_back(vr);
	if (!u[p[vr]]) dfs(p[vr]);
}
bool cmp(pair<int, int>p1, pair<int, int>p2)
{
	if (p1.first == p2.first)
		return p1.second > p2.second;
	return p1.first > p2.first;
}
int main()
{
	cin >> n >> s;
	for (int i=0;i<n;i++)
	{
		cin >> a[i];
		pair<int, int>tmp;
		tmp.first = a[i];
		tmp.second = i;
		b[i] = tmp;
	}
	sort(b.begin(), b.begin()+n);
	for (int i=0;i<n;i++) p[b[i].second] = i;
	//for (int i = 0; i < n; i++)
	//    cout << p[i] << " ";
	//cout << endl;
	for (int i=0;i<n;i++)
	{
		if (a[i] == b[i].first && p[i] != i)
		{
			p[b[i].second] = p[i];
			b[p[i]].second = b[i].second;
			p[i] = i;
			b[i].second = i;
		}
	}
	//for (int i = 0; i < n; i++)
	//    cout << p[i] << " ";
	//cout << endl;
	for (int i=0;i<n;i++)
	{
		rodic[i] = i;
		r[i] = 0;
	}
	for (int i=0;i<n;i++) spojset(p[i], i);
	int ls = -1;
	for (int i=0;i<n;i++) // hladame hrany
	{
		if (p[b[i].second] == b[i].second) continue;
		if (ls >= 0 && a[ls] == a[b[i].second])
		{
			int va = ls, vb = b[i].second;
			if (najdisef(va) == najdisef(vb)) continue;
			spojset(va, vb);
			swap(p[va], p[vb]);
		}
		ls = b[i].second;
	}
	//for (int i = 0; i < n; i++)
	//    cout << p[i] << " ";
	//cout << endl;
	t = 0;
	for (int i=0;i<n;i++) // spocitame pocet komponentov
		if (u[i] == 0 && p[i] != i){
			dfs(i);
			t++;
		}
	int ans = 0;
	for (int i=0;i<t;i++)
		ans += c[i].size();
	// nasli sme odpoved
	if (ans > s)
	{
		cout << "-1\n"; return 0;
	}
	s -= ans;
	s = min(s, t);
	if (s <= 1)
	{
		cout << t << endl;
		for (int i=0;i<t;i++)
		{
			cout << c[i].size() << endl;
			for (int j = 0; j < c[i].size();j++)
				cout << c[i][j]+1 << " ";
			cout << endl;
		}
		return 0;
	}
	cout << (t-s+2) << endl;
	for (int i=0;i<t-s;i++)
	{
		cout << c[i+s].size() << endl;
			for (int j = 0; j < c[i+s].size();j++)
				cout << c[i+s][j]+1 << " ";
		cout << endl;
		ans -= c[i+s].size();
	}
	cout << ans << endl;
	for (int i=0;i<s;i++)
		for (int j = 0; j < c[i].size();j++)
			cout << c[i][j]+1 << " ";
	cout << endl;
	cout << s << endl;
	for (int i=s-1;i>=0;i--)
		cout << c[i][0]+1 << " ";
	cout << "\n";
	return 0;
}


// only miss the sun when it starts to snow

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int maxn=2e5+10,mod=1e9+7;
const ll inf=1e18;

int a[maxn], nxt[maxn];
pii srt[maxn];
map<int, vector<int> >mp;
vector< vector<int> > ans;

int par[maxn];

int fnd(int u){
    return par[u]<0 ? u : par[u]=fnd(par[u]);
}
void mrg(int a,int b){
    if( (a=fnd(a)) == (b=fnd(b)) ) return;
    if(par[a]>par[b]) swap(a,b);
    par[a]+=par[b];
    par[b]=a;
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);

    memset(par,-1,sizeof par);

    int n,s; cin>>n>>s;

    for(int i=0;i<n;i++){
	cin>>a[i];
	srt[i]= {a[i],i};
    }

    sort(srt,srt+n);

    for(int i=0;i<n;i++){
	nxt[i]= i;
    }
    for(int i=0;i<n;i++){
	if(srt[i].F!=a[i]){
	    nxt[ srt[i].S ]= i;
	    mp[srt[i].F].PB(srt[i].S);
	}
    }

    for(int i=0;i<n;i++){
	int tmp=nxt[i];
	s-= fnd(i) != fnd(tmp);
	while( fnd(tmp) != fnd(i) ){
	    mrg(tmp, i);
	    tmp=nxt[tmp];
	    s--;
	}
    }
    for(auto &IT:mp){
	for(int i=0;i<sz(IT.S)-1;i++){
	    int A=IT.S[i], B=IT.S[i+1];
	    if(fnd(A) != fnd(B))
		swap(nxt[A], nxt[B]), mrg(A,B);
	}
    }
    if(s<0) return cout<<-1<<endl,0;

    set<int> st;
    vector<int> vv;

    for(int i=0;i<n;i++){
	if(st.count( fnd(i) ) ) continue;
	if(s==0) continue;
	st.insert( fnd(i) );
	vv.PB(i);
	s--;
    }

    if(sz(vv)>2){
	for(int i=1;i<sz(vv);i++){
	    swap(nxt[vv[0]], nxt[vv[i]] );
	}

	reverse(vv.begin(), vv.end() );
	ans.PB(vv);
    }

    st.clear();

    for(int i=0;i<n;i++){
	if(nxt[i]==i) continue;
	if(st.count(i)) continue;

	vv.clear();
	int tmp=i;

	while(st.count(tmp) == 0){
	    st.insert(tmp);
	    vv.PB(tmp);
	    tmp=nxt[tmp];
	}
	ans.PB(vv);
    }

    cout<<sz(ans)<<"\n";

    for(int i=0;i<sz(ans);i++){
	cout<<sz(ans[i])<<"\n";
	for(int x:ans[i])
	    cout<<x+1<<" ";
	cout<<"\n";
    }
    return 0;
}
// Deathly mistakes:
//  * Read the problem curfully.
//  * Check maxn.
//  * Overflows.

// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


// only miss the sun when it starts to snow

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int maxn=2e5+10,mod=1e9+7;
const ll inf=1e18;

int a[maxn], b[maxn], nxt[maxn];
pii srt[maxn];
map<int, vector<int> >mp;
vector< vector<int> > ans;

int par[maxn], who[maxn];

int fnd(int u){
    return par[u]<0 ? u : par[u]=fnd(par[u]);
}
void mrg(int a,int b){
    if( (a=fnd(a)) == (b=fnd(b)) ) return;
    if(par[a]>par[b]) swap(a,b);
    par[a]+=par[b];
    par[b]=a;
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);

    memset(par,-1,sizeof par);

    int n,s; cin>>n>>s;

    for(int i=0;i<n;i++){
	cin>>a[i];
	srt[i]= {a[i],i};
    }

    sort(srt,srt+n);

    int N=0;

    for(int i=0;i<n;i++){
	if(srt[i].F != a[i]){
	    who[N]= i;
	    b[N++]= a[i];
	}
    }

    memcpy(a,b,sizeof a), n=N;

    for(int i=0;i<n;i++){
	srt[i]= {a[i],i};
    }
    sort(srt,srt+n);

    for(int i=0;i<n;i++){
	nxt[i]= i;
    }
    for(int i=0;i<n;i++){
	if(srt[i].F!=a[i]){
	    nxt[ srt[i].S ]= i;
	    mp[srt[i].F].PB(srt[i].S);
	}
    }

    for(int i=0;i<n;i++){
	int tmp=nxt[i];
	s-= fnd(i) != fnd(tmp);
	while( fnd(tmp) != fnd(i) ){
	    mrg(tmp, i);
	    tmp=nxt[tmp];
	    s--;
	}
    }
    for(auto &IT:mp){
	for(int i=0;i<sz(IT.S)-1;i++){
	    int A=IT.S[i], B=IT.S[i+1];
	    if(fnd(A) != fnd(B))
		swap(nxt[A], nxt[B]), mrg(A,B);
	}
    }
    if(s<0) return cout<<-1<<endl,0;

    set<int> st;
    vector<int> vv;

    for(int i=0;i<n;i++){
	if(st.count( fnd(i) ) ) continue;
	if(s==0) continue;
	st.insert( fnd(i) );
	vv.PB(i);
	s--;
    }

    if(sz(vv)>2){
	for(int i=1;i<sz(vv);i++){
	    swap(nxt[vv[0]], nxt[vv[i]] );
	}
	ans.PB(vv);
    }

    st.clear();

    for(int i=0;i<n;i++){
	if(nxt[i]==i) continue;
	if(st.count(i)) continue;

	vv.clear();
	int tmp=i;

	while(st.count(tmp) == 0){
	    st.insert(tmp);
	    vv.PB(tmp);
	    tmp=nxt[tmp];
	}
	ans.PB(vv);
    }

    cout<<sz(ans)<<"\n";

    for(int i=0;i<sz(ans);i++){
	cout<<sz(ans[i])<<"\n";
	for(int x:ans[i])
	    cout<<who[x]+1<<" ";
	cout<<"\n";
    }
    return 0;
}
// Deathly mistakes:
//  * Read the problem curfully.
//  * Check maxn.
//  * Overflows.

// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


// only miss the sun when it starts to snow

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int maxn=2e5+10,mod=1e9+7;
const ll inf=1e18;

int a[maxn], b[maxn], nxt[maxn];
pii srt[maxn];
map<int, vector<int> >mp;
vector< vector<int> > ans;

int par[maxn], who[maxn];

int fnd(int u){
    return par[u]<0 ? u : par[u]=fnd(par[u]);
}
void mrg(int a,int b){
    if( (a=fnd(a)) == (b=fnd(b)) ) return;
    if(par[a]>par[b]) swap(a,b);
    par[a]+=par[b];
    par[b]=a;
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);

    memset(par,-1,sizeof par);

    int n,s; cin>>n>>s;

    for(int i=0;i<n;i++){
	cin>>a[i];
	srt[i]= {a[i],i};
    }

    sort(srt,srt+n);

    int N=0;

    for(int i=0;i<n;i++){
	if(srt[i].F != a[i]){
	    who[N]= i;
	    b[N++]= a[i];
	}
    }

    memcpy(a,b,sizeof a), n=N;

    for(int i=0;i<n;i++){
	srt[i]= {a[i],i};
    }
    sort(srt,srt+n);

    for(int i=0;i<n;i++){
	nxt[i]= i;
    }
    for(int i=0;i<n;i++){
	if(srt[i].F!=a[i]){
	    nxt[ srt[i].S ]= i;
	    mp[srt[i].F].PB(srt[i].S);
	}
    }

    for(int i=0;i<n;i++){
	int tmp=nxt[i];
	s-= fnd(i) != fnd(tmp);
	while( fnd(tmp) != fnd(i) ){
	    mrg(tmp, i);
	    tmp=nxt[tmp];
	    s--;
	}
    }
    for(auto &IT:mp){
	for(int i=0;i<sz(IT.S)-1;i++){
	    int A=IT.S[i], B=IT.S[i+1];
	    if(fnd(A) != fnd(B))
		swap(nxt[A], nxt[B]), mrg(A,B);
	}
    }
    if(s<0) return cout<<-1<<endl,0;

    set<int> st;
    vector<int> vv;

    for(int i=0;i<n;i++){
	if(st.count( fnd(i) ) ) continue;
	if(s==0) continue;
	st.insert( fnd(i) );
	vv.PB(i);
	s--;
    }

    if(sz(vv)>2){
	for(int i=1;i<sz(vv);i++){
	    swap(nxt[vv[0]], nxt[vv[i]] );
	}

	reverse(vv.begin(), vv.end() );
	ans.PB(vv);
    }

    st.clear();

    for(int i=0;i<n;i++){
	if(nxt[i]==i) continue;
	if(st.count(i)) continue;

	vv.clear();
	int tmp=i;

	while(st.count(tmp) == 0){
	    st.insert(tmp);
	    vv.PB(tmp);
	    tmp=nxt[tmp];
	}
	ans.PB(vv);
    }

    cout<<sz(ans)<<"\n";

    for(int i=0;i<sz(ans);i++){
	cout<<sz(ans[i])<<"\n";
	for(int x:ans[i])
	    cout<<who[x]+1<<" ";
	cout<<"\n";
    }
    return 0;
}
// Deathly mistakes:
//  * Read the problem curfully.
//  * Check maxn.
//  * Overflows.

// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


#include<bits/stdc++.h>
using namespace std;

#define N 200010

int a[N], b[N], nxt[N];
bool vis[N];

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n, s;
    cin >> n >> s;
    for(int i = 1; i <= n; i ++) cin >> a[i], b[i] = a[i];
    sort(b+1, b+n+1);
    vector <int> v;
    for(int i = 1; i <= n; i ++) if(a[i] != b[i]) v.push_back(i);
    if(v.size() > s) {
        puts("-1");
        return 0;
    }
    vector <int> u = v;
    sort(v.begin(), v.end(), [&](int i, int j) {return a[i] < a[j];});
    for(int i = 0; i < v.size(); i ++) nxt[u[i]] = v[i];
    vector <int> f(n+1);
    for(int i = 1; i <= n; i ++) f[i] = i;
    function <int(int)> find = [&](int x) {return x == f[x] ? x : f[x] = find(f[x]);};
    for(int i = 0; i < v.size(); i ++) {
        int x = find(u[i]), y = find(v[i]);
        f[x] = y;
    }
    for(int i = 0, prv = -1; i < v.size(); i ++) {
        if(a[v[i]] == prv) {
            int x = find(v[i]), y = find(v[i-1]);
            if(x != y) {
                swap(nxt[v[i]], nxt[v[i-1]]);
                f[x] = y;
            }
        }
        prv = a[v[i]];
    }
    vector <vector <int> > R;
    for(int i = 0; i < v.size(); i ++) {
        int x = v[i];
        if(vis[x]) continue;
        vector <int> r;
        while(vis[x] == 0) r.push_back(x), vis[x] = 1, x = nxt[x];
        R.push_back(r);
    }
    int k = min(s-u.size(), R.size());
    if(k <= 2) k = 0;
    int ans = R.size() - k;
    if(k > 2) ans += 2;
    cout << ans << endl;
    if(k > 2) {
        cout << 2*k << endl;
        for(int i = 0; i < k; i ++) cout << R[i][0] << ' ' << R[i][1] << ' ';
        cout << endl;
        int sum = 0;
        for(int i = 0; i < k; i ++) sum += R[i].size()-1;
        cout << sum << endl;
        for(int i = 0; i < k; i ++) {
            for(int j = 2; j < R[i].size(); j ++) cout << R[i][j] << ' ';
            cout << R[i][0] << endl;
        }
    }
    for(int i = k; i < R.size(); i ++) {
        cout << R[i].size() << endl;
        for(int j = 0; j < R[i].size(); j ++) cout << R[i][j] << ' ';
        cout << endl;
    }
}