#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[v[i]] = u[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;
    }
}


#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[v[i]] = u[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 = k-1; i >= 0; i --) {
            for(int j = 2; j < R[i].size(); j ++) cout << R[i][j] << ' ';
            cout << R[i][0] << ' ';
        }
        cout << 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;
    }
}


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

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

const int N = 2e5 + 25;
int a[N], b[N], c[N], cycsz;
vector<int> g[N], cyc[N];

void dfs(int v){
	while(!g[v].empty()){
		int u = g[v].back(); g[v].pop_back();
		dfs(a[u]); cyc[cycsz].push_back(u);
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(32);

	int n, s;
	cin >> n >> s;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b, b + n);
	memcpy(c, b, sizeof(int)*n);
	int sz = unique(c, c + n) - c;
	for(int i = 0; i < n; i++){
		a[i] = lower_bound(c, c + sz, a[i]) - c;
		b[i] = lower_bound(c, c + sz, b[i]) - c;
		if(a[i] == b[i])continue;
		g[b[i]].push_back(i);
	}
	cycsz = 0;
	for(int i = 0; i < sz; i++){
		if(g[i].empty())continue;
		dfs(i); cycsz++;
	}
	int sum = 0;
	for(int i = 0; i < cycsz; i++){
		sum += cyc[i].size();
		reverse(cyc[i].begin(), cyc[i].end());
	}
	if(sum > s){
		cout << -1 << '\n';
		exit(0);
	}
	int x = min(cycsz, s - sum);
	vector<vector<int> > ans;
	if(x){
		vector<int> perm1, perm2;
		for(int i = 0; i < x; i++){
			for(auto y : cyc[i]){
				perm1.push_back(y);
			}
			perm2.push_back(cyc[i][0]);
		}
		reverse(perm2.begin(), perm2.end());
		ans.push_back(perm1);
		if(x > 1)ans.push_back(perm2);
	}
	for(int i = x; i < cycsz; i++){
		ans.push_back(cyc[i]);
	}
	cout << ans.size() << '\n';
	for(auto vec : ans){
		cout << vec.size() << '\n';
		for(auto y : vec){
			cout << y + 1 << " ";
		}
		cout << '\n';
	}

	return 0;
}


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

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

const int N = 2e5 + 25;
int a[N], b[N], c[N], cycsz;
vector<int> g[N], cyc[N];

void dfs(int v){
	while(!g[v].empty()){
		int u = g[v].back(); g[v].pop_back();
		dfs(a[u]); cyc[cycsz].push_back(u);
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(32);

	int n, s;
	cin >> n >> s;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b, b + n);
	memcpy(c, b, sizeof(int)*n);
	int sz = unique(c, c + n) - c;
	for(int i = 0; i < n; i++){
		a[i] = lower_bound(c, c + sz, a[i]) - c;
		b[i] = lower_bound(c, c + sz, b[i]) - c;
		if(a[i] == b[i])continue;
		g[b[i]].push_back(i);
	}
	cycsz = 0;
	for(int i = 0; i < sz; i++){
		if(g[i].empty())continue;
		dfs(i); cycsz++;
	}
	int sum = 0;
	for(int i = 0; i < cycsz; i++){
		sum += cyc[i].size();
		reverse(cyc[i].begin(), cyc[i].end());
	}
	if(sum > s){
		cout << -1 << '\n';
		exit(0);
	}
	int x = min(cycsz, s - sum);
	vector<vector<int> > ans;
	if(x){
		vector<int> perm1, perm2;
		for(int i = 0; i < x; i++){
			for(auto y : cyc[i]){
				perm1.push_back(y);
			}
			perm2.push_back(cyc[i].back());
		}
		reverse(perm2.begin(), perm2.end());
		ans.push_back(perm1);
		if(x > 1)ans.push_back(perm2);
	}
	for(int i = x; i < cycsz; i++){
		ans.push_back(cyc[i]);
	}
	cout << ans.size() << '\n';
	for(auto vec : ans){
		cout << vec.size() << '\n';
		for(auto y : vec){
			cout << y + 1 << " ";
		}
		cout << '\n';
	}

	return 0;
}


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

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

const int N = 2e5 + 25;
int a[N], b[N], c[N], cycsz;
vector<int> g[N], cyc[N];

void dfs(int v){
	while(!g[v].empty()){
		int u = g[v].back(); g[v].pop_back();
		dfs(a[u]); cyc[cycsz].push_back(u);
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(32);

	int n, s;
	cin >> n >> s;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b, b + n);
	memcpy(c, b, sizeof(int)*n);
	int sz = unique(c, c + n) - c;
	for(int i = 0; i < n; i++){
		a[i] = lower_bound(c, c + sz, a[i]) - c;
		b[i] = lower_bound(c, c + sz, b[i]) - c;
		if(a[i] == b[i])continue;
		g[b[i]].push_back(i);
	}
	cycsz = 0;
	for(int i = 0; i < sz; i++){
		if(g[i].empty())continue;
		dfs(i); cycsz++;
	}
	int sum = 0;
	for(int i = 0; i < cycsz; i++){
		sum += cyc[i].size();
		reverse(cyc[i].begin(), cyc[i].end());
	}
	if(sum > s){
		cout << -1 << '\n';
		exit(0);
	}
	int x = min(cycsz, s - sum);
	vector<vector<int> > ans;
	if(x){
		vector<int> perm1, perm2;
		for(int i = 0; i < x; i++){
			for(auto y : cyc[i]){
				perm1.push_back(y);
			}
			perm2.push_back(cyc[i].back());
		}
		reverse(perm2.begin(), perm2.end());
		ans.push_back(perm1);
		ans.push_back(perm2);
	}
	for(int i = x; i < cycsz; i++){
		ans.push_back(cyc[i]);
	}
	cout << ans.size() << '\n';
	for(auto vec : ans){
		cout << vec.size() << '\n';
		for(auto y : vec){
			cout << y + 1 << " ";
		}
		cout << '\n';
	}

	return 0;
}


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

#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=2e5+5;
int a[N];
int b[N],t[N],nt[N],u;
vector<int>ans[N];int top;

int NT(int x)
{
	while(nt[x]<t[x+1]&&a[nt[x]]==x)++nt[x];
	return nt[x];
}
void dfs(int x)
{
	while(NT(x)<t[x+1])
	{
		int now=nt[x]++;
		dfs(a[now]);
		ans[top].push_back(now);
	}
}

int main()
{
//	freopen("1.in","r",stdin);
	int n,s;
	cin>>n>>s;
	rep(i,1,n)scanf("%d",a+i);
	rep(i,1,n)b[i]=a[i];
	sort(b+1,b+n+1);
	rep(i,1,n)
	if(b[i]!=b[u])
	{
		++u;
		t[u]=i;
		b[u]=b[i];
	}
	t[u+1]=n+1;
	rep(i,1,n)a[i]=lower_bound(b+1,b+u+1,a[i])-b;

	rep(i,1,u)nt[i]=t[i];
	rep(i,1,u)
	if(NT(i)<t[i+1])
	{
		++top;
		dfs(i);
		s-=ans[top].size();
	}
	if(s<0)puts("-1");
	else
	{
		printf("%d\n",top);
		rep(i,1,top)
		{
			printf("%d\n",(int)ans[i].size());
			for(auto x:ans[i])printf("%d ",x);
			puts("");
		}
	}
}


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

#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=2e5+5;
int a[N];
int b[N],t[N],nt[N],u;
vector<int>ans[N];int top;

int NT(int x)
{
	while(nt[x]<t[x+1]&&a[nt[x]]==x)++nt[x];
	return nt[x];
}
void dfs(int x)
{
	while(NT(x)<t[x+1])
	{
		int now=nt[x]++;
		dfs(a[now]);
		ans[top].push_back(now);
	}
}

int main()
{
//	freopen("1.in","r",stdin);
	int n,s;
	cin>>n>>s;
	rep(i,1,n)scanf("%d",a+i);
	rep(i,1,n)b[i]=a[i];
	sort(b+1,b+n+1);
	rep(i,1,n)
	if(b[i]!=b[u])
	{
		++u;
		t[u]=i;
		b[u]=b[i];
	}
	t[u+1]=n+1;
	rep(i,1,n)a[i]=lower_bound(b+1,b+u+1,a[i])-b;

	rep(i,1,u)nt[i]=t[i];
	rep(i,1,u)
	if(NT(i)<t[i+1])
	{
		++top;
		dfs(i);
		s-=ans[top].size();
	}
	if(s<0)puts("-1");
	else
	{
		printf("%d\n",top);
		rep(i,1,top)
		{
			printf("%d\n",(int)ans[i].size());
			reverse(ans[i].begin(),ans[i].end());
			for(auto x:ans[i])printf("%d ",x);
			puts("");
		}
	}
}


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

#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
const int N=2e5+5;
int a[N];
int b[N],t[N],nt[N],u;
vector<int>ans[N];int top;

int NT(int x)
{
	while(nt[x]<t[x+1]&&a[nt[x]]==x)++nt[x];
	return nt[x];
}
void dfs(int x)
{
	while(NT(x)<t[x+1])
	{
		int now=nt[x]++;
		dfs(a[now]);
		ans[top].push_back(now);
	}
}

int main()
{
#ifdef kcz
	freopen("1.in","r",stdin);freopen("1.out","w",stdout);
#endif
	int n,s;
	cin>>n>>s;
	rep(i,1,n)scanf("%d",a+i);
	rep(i,1,n)b[i]=a[i];
	sort(b+1,b+n+1);
	rep(i,1,n)
	if(b[i]!=b[u])
	{
		++u;
		t[u]=i;
		b[u]=b[i];
	}
	t[u+1]=n+1;
	rep(i,1,n)a[i]=lower_bound(b+1,b+u+1,a[i])-b;

	rep(i,1,u)nt[i]=t[i];
	rep(i,1,u)
	if(NT(i)<t[i+1])
	{
		++top;
		dfs(i);
		s-=ans[top].size();
		reverse(ans[top].begin(),ans[top].end());
	}
	if(s<0)puts("-1");
	else
	{
		s=min(s,top);
	if(s<2)
	{
		printf("%d\n",top);
	#ifndef kcz
		rep(i,1,top)
		{
			printf("%d\n",(int)ans[i].size());
			for(auto x:ans[i])printf("%d ",x);
			puts("");
		}
	#endif
	}
	else
	{
		printf("%d\n",top-s+2);

		int sum=0;
		rep(i,1,s)sum+=ans[i].size();
		printf("%d\n",sum);
		rep(i,1,s)for(auto x:ans[i])printf("%d ",x);
		puts("");

		printf("%d\n",s);
		per(i,s,1)printf("%d ",ans[i][0]);
		puts("");

		rep(i,s+1,top)
		{
			printf("%d\n",(int)ans[i].size());
			for(auto x:ans[i])printf("%d ",x);
			puts("");
		}
	}
	}
}


#include<bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

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

template <typename T> bool chkmax(T &x,T y){return x<y?x=y,true:false;}
template <typename T> bool chkmin(T &x,T y){return x>y?x=y,true:false;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int n,s;
int a[200005],f[200005],to[200005];
pii b[200005];
bool vis[200005];
vector<vector<int> > ans;

int getf(int x){return x==f[x]?x:f[x]=getf(f[x]);}

int main(){
	n=readint(); s=readint();
	for(int i=1;i<=n;i++) a[i]=readint(),b[i]=mp(a[i],i);
	sort(b+1,b+n+1);
	for(int i=1;i<=n;i++) to[b[i].se]=i;
//	for(int i=1;i<=n;i++) cout<<to[i]<<' ';
//	cout<<endl;
	for(int i=1;i<=n;i++)
		while(i!=to[i]&&a[to[i]]==b[to[i]].fi)
			swap(b[to[i]].se,b[to[to[i]]].se),swap(to[to[i]],to[i]);
	for(int i=1;i<=n;i++) f[i]=i;
	int all=n,cnt=0;
	for(int i=1;i<=n;i++){
		if(i==to[i]) all--;
		if(vis[i]||i==to[i]) continue;
		vis[i]=1;
		cnt++;
		for(int j=to[i];j!=i;j=to[j]) vis[j]=1,f[j]=i;
	}
//	for(int i=1;i<=n;i++) cout<<to[i]<<' ';
//	cout<<endl;
	int lst=0;
	for(int i=1;i<=n;i++){
		if(b[i].se==i) continue;
		if(!lst||b[i].fi!=b[lst].fi){
			lst=i;
			continue;
		}
		if(getf(b[lst].se)!=getf(b[i].se)){
			f[f[b[i].se]]=f[b[lst].se];
			swap(to[b[i].se],to[b[lst].se]);
			swap(b[i].se,b[lst].se);
			cnt--;
		}
	}
//	for(int i=1;i<=n;i++) cout<<to[i]<<' ';
//	cout<<endl;
	if(all>s) return printf("-1\n"),0;
	int tmp=s-all,num=0;
	vector<int> now(0),rem(0);
	for(int i=1;i<=n;i++){
		if(i==to[i]) continue;
		if(i!=f[i]) continue;
		now.pb(i);
		for(int j=to[i];j!=i;j=to[j]) now.pb(j);
		rem.pb(i);
		num++;
		if(num>=tmp){
			ans.pb(now);
			reverse(rem.begin(),rem.end());
			if(rem.size()>1) ans.pb(rem);
			now.clear(),rem.clear();
		}
	}
	if(now.size()) ans.pb(now);
	reverse(rem.begin(),rem.end());
	if(rem.size()>1) ans.pb(rem);
	printf("%d\n",ans.size());
	for(auto v:ans){
		printf("%d\n",v.size());
		for(auto x:v) printf("%d ",x);
		printf("\n");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using pii = pair<int, int>;
#define dbg(x) cerr<<#x": "<<(x)<<'\n'
#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<'\n'
#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<'\n';}
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define INF 2000000010
#define MOD 1000000007
#define ST_SIZE 1048600
#define QMAX
#define NMAX 200010

int n, s;
int a[NMAX], b[NMAX];
int p[NMAX];
bool used[NMAX];
int fth[NMAX];
vector<vector<int>> cycles;
map<int, vector<int>> v, pos;

int root(int x) { return fth[x] == -1 ? x : fth[x] = root(fth[x]); }
bool join(int x, int y) {
	x = root(x); y = root(y);
	if(x == y) return false;

	if((x + y) & 1) fth[x] = y;
	else fth[y] = x;

	return true;
}

void getMinPerm() {
	int i;

	for(i = 1; i <= n; ++i) b[i] = a[i];
	sort(b + 1, b + n + 1);

	for(i = 1; i <= n; ++i) if(a[i] != b[i]) v[b[i]].push_back(i);

	for(i = 1; i <= n; ++i) {
		if(a[i] == b[i]) p[i] = i;
		else {
			p[i] = v[a[i]].back();
			v[a[i]].pop_back();
		}
	}

	for(i = 1; i <= n; ++i) join(i, p[i]);
	for(i = 1; i <= n; ++i) if(a[i] != b[i]) pos[a[i]].push_back(i);
	for(const auto &item : pos) {
		for(auto val : item.se)
			if(join(p[val], p[item.se[0]])) {
				swap(p[val], p[item.se[0]]);
			}
	}

	// dbg_v(p + 1, n);
}

void solve() {
	int i, t;

	for(t = 0, i = 1; i <= n; ++i) {
		if(p[i] == i) continue;
		if(used[i]) continue;

		cycles.push_back(vector<int>());
		for(int j = i; !used[j]; used[j] = true, j = p[j]) cycles.back().push_back(j);

		t += cycles.back().size();
	}

	int m = cycles.size();
	int x = max(m + t - s, 0);
	int y = m - x;

	if(t > s) return void(cout << "-1\n");

	cout << (x + min(y, 2)) << '\n';

	if(y == 1) ++x;
	while(x--) {
		cout << cycles.back().size() << '\n';
		for(auto val : cycles.back()) cout << val << ' ';
		cout << '\n';

		cycles.pop_back();
	}

	if(cycles.empty()) return;

	int sum = 0;
	for(i = cycles.size() - 1; i >= 0; --i) sum += cycles[i].size();
	cout << '\n';

	cout << sum << '\n';
	for(const auto &vec : cycles) {
		cout << vec.size() << '\n';
		for(auto val : vec) cout << val << ' ';
	}
	cout << '\n';

	cout << cycles.size() << '\n';
	for(i = cycles.size() - 1; i >= 0; --i) cout << cycles[i][0] << ' ';
	cout << '\n';
}

int main()
{
	ios_base::sync_with_stdio(false);

	int i;

	memset(fth, -1, sizeof fth);

	cin >> n >> s;
	for(i = 1; i <= n; ++i) cin >> a[i];

	getMinPerm();
	solve();

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using pii = pair<int, int>;
#define dbg(x) cerr<<#x": "<<(x)<<'\n'
#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<'\n'
#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<'\n';}
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define INF 2000000010
#define MOD 1000000007
#define ST_SIZE 1048600
#define QMAX
#define NMAX 200010

int n, s;
int a[NMAX], b[NMAX];
int p[NMAX];
bool used[NMAX];
int fth[NMAX];
vector<vector<int>> cycles;
map<int, vector<int>> v, pos;

int root(int x) { return fth[x] == -1 ? x : fth[x] = root(fth[x]); }
bool join(int x, int y) {
	x = root(x); y = root(y);
	if(x == y) return false;

	if((x + y) & 1) fth[x] = y;
	else fth[y] = x;

	return true;
}

void getMinPerm() {
	int i;

	for(i = 1; i <= n; ++i) b[i] = a[i];
	sort(b + 1, b + n + 1);

	for(i = 1; i <= n; ++i) if(a[i] != b[i]) v[b[i]].push_back(i);

	for(i = 1; i <= n; ++i) {
		if(a[i] == b[i]) p[i] = i;
		else {
			p[i] = v[a[i]].back();
			v[a[i]].pop_back();
		}
	}

	for(i = 1; i <= n; ++i) join(i, p[i]);
	for(i = 1; i <= n; ++i) if(a[i] != b[i]) pos[a[i]].push_back(i);
	for(const auto &item : pos) {
		for(auto val : item.se)
			if(join(p[val], p[item.se[0]])) {
				swap(p[val], p[item.se[0]]);
			}
	}

	// dbg_v(p + 1, n);
}

void solve() {
	int i, t;

	for(t = 0, i = 1; i <= n; ++i) {
		if(p[i] == i) continue;
		if(used[i]) continue;

		cycles.push_back(vector<int>());
		for(int j = i; !used[j]; used[j] = true, j = p[j]) cycles.back().push_back(j);

		t += cycles.back().size();
	}

	int m = cycles.size();
	int x = max(m + t - s, 0);
	int y = m - x;

	if(t > s) return void(cout << "-1\n");

	cout << (x + min(y, 2)) << '\n';

	if(y == 1) ++x;
	while(x--) {
		cout << cycles.back().size() << '\n';
		for(auto val : cycles.back()) cout << val << ' ';
		cout << '\n';

		cycles.pop_back();
	}

	if(cycles.empty()) return;

	int sum = 0;
	for(i = cycles.size() - 1; i >= 0; --i) sum += cycles[i].size();
	cout << '\n';

	cout << sum << '\n';
	for(const auto &vec : cycles) {
		// cout << vec.size() << '\n';
		for(auto val : vec) cout << val << ' ';
	}
	cout << '\n';

	cout << cycles.size() << '\n';
	for(i = cycles.size() - 1; i >= 0; --i) cout << cycles[i][0] << ' ';
	cout << '\n';
}

int main()
{
	ios_base::sync_with_stdio(false);

	int i;

	memset(fth, -1, sizeof fth);

	cin >> n >> s;
	for(i = 1; i <= n; ++i) cin >> a[i];

	getMinPerm();
	solve();

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using pii = pair<int, int>;
#define dbg(x) cerr<<#x": "<<(x)<<'\n'
#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<'\n'
#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<'\n';}
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define INF 2000000010
#define MOD 1000000007
#define ST_SIZE 1048600
#define QMAX
#define NMAX 200010

int n, s;
int a[NMAX], b[NMAX];
int p[NMAX];
bool used[NMAX];
int fth[NMAX];
vector<vector<int>> cycles;
map<int, vector<int>> v, pos;

int root(int x) { return fth[x] == -1 ? x : fth[x] = root(fth[x]); }
bool join(int x, int y) {
	x = root(x); y = root(y);
	if(x == y) return false;

	if((x + y) & 1) fth[x] = y;
	else fth[y] = x;

	return true;
}

void getMinPerm() {
	int i;

	for(i = 1; i <= n; ++i) b[i] = a[i];
	sort(b + 1, b + n + 1);

	for(i = 1; i <= n; ++i) if(a[i] != b[i]) v[b[i]].push_back(i);

	for(i = 1; i <= n; ++i) {
		if(a[i] == b[i]) p[i] = i;
		else {
			p[i] = v[a[i]].back();
			v[a[i]].pop_back();
		}
	}

	for(i = 1; i <= n; ++i) join(i, p[i]);
	for(i = 1; i <= n; ++i) if(a[i] != b[i]) pos[a[i]].push_back(i);
	for(const auto &item : pos) {
		for(auto val : item.se)
			if(join(p[val], p[item.se[0]])) {
				swap(p[val], p[item.se[0]]);
			}
	}

	// dbg_v(p + 1, n);
}

void solve() {
	int i, t;

	for(t = 0, i = 1; i <= n; ++i) {
		if(p[i] == i) continue;
		if(used[i]) continue;

		cycles.push_back(vector<int>());
		for(int j = i; !used[j]; used[j] = true, j = p[j]) cycles.back().push_back(j);

		t += cycles.back().size();
	}

	int m = cycles.size();
	int x = max(m + t - s, 0);
	int y = m - x;

	if(t > s) return void(cout << "-1\n");

	cout << (x + min(y, 2)) << '\n';

	if(y == 1) ++x;
	while(x--) {
		for(auto val : cycles.back()) cout << val << ' ';
		cout << '\n';

		cycles.pop_back();
	}

	if(cycles.empty()) return;

	for(const auto &vec : cycles)
		for(auto val : vec) cout << val << ' ';
	cout << '\n';

	for(i = cycles.size() - 1; i >= 0; --i) cout << cycles[i][0] << ' ';
	cout << '\n';
}

int main()
{
	ios_base::sync_with_stdio(false);

	int i;

	memset(fth, -1, sizeof fth);

	cin >> n >> s;
	for(i = 1; i <= n; ++i) cin >> a[i];

	getMinPerm();
	solve();

	return 0;
}


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

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

#define mp make_pair
#define mt make_tuple
#define one(x) memset(x,-1,sizeof(x))
#define zero(x) memset(x,0,sizeof(x))
#ifdef LOCAL
void dmpr(ostream&os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ";
	dmpr(os,args...);
}
#define dmp2(...) dmpr(cerr,__LINE__,##__VA_ARGS__)
#else
#define dmp2(...) void(0)
#endif

using uint=unsigned;
using ull=unsigned long long;

template<class t,size_t n>
ostream& operator<<(ostream&os,const array<t,n>&a){
	return os<<vc<t>(all(a));
}

template<int i,class T>
void print_tuple(ostream&,const T&){
}

template<int i,class T,class H,class ...Args>
void print_tuple(ostream&os,const T&t){
	if(i)os<<",";
	os<<get<i>(t);
	print_tuple<i+1,T,Args...>(os,t);
}

template<class ...Args>
ostream& operator<<(ostream&os,const tuple<Args...>&t){
	os<<"{";
	print_tuple<0,tuple<Args...>,Args...>(os,t);
	return os<<"}";
}

template<class t>
void print(t x,int suc=1){
	cout<<x;
	if(suc==1)
		cout<<"\n";
	if(suc==2)
		cout<<" ";
}

ll read(){
	ll i;
	cin>>i;
	return i;
}

vi readvi(int n,int off=0){
	vi v(n);
	rep(i,n)v[i]=read()+off;
	return v;
}

template<class T>
void print(const vector<T>&v,int suc=1){
	rep(i,v.size())
		print(v[i],i==int(v.size())-1?suc:2);
}

string readString(){
	string s;
	cin>>s;
	return s;
}

template<class T>
T sq(const T& t){
	return t*t;
}

//#define CAPITAL
void yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<"\n";
	#else
	cout<<"Yes"<<"\n";
	#endif
	if(ex)exit(0);
}
void no(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<"\n";
	#else
	cout<<"No"<<"\n";
	#endif
	if(ex)exit(0);
}
void possible(bool ex=true){
	#ifdef CAPITAL
	cout<<"POSSIBLE"<<"\n";
	#else
	cout<<"Possible"<<"\n";
	#endif
	if(ex)exit(0);
}
void impossible(bool ex=true){
	#ifdef CAPITAL
	cout<<"IMPOSSIBLE"<<"\n";
	#else
	cout<<"Impossible"<<"\n";
	#endif
	if(ex)exit(0);
}

constexpr ll ten(int n){
	return n==0?1:ten(n-1)*10;
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

int topbit(signed t){
	return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
	return t==0?-1:63-__builtin_clzll(t);
}
int botbit(signed a){
	return a==0?32:__builtin_ctz(a);
}
int botbit(ll a){
	return a==0?64:__builtin_ctzll(a);
}
int popcount(signed t){
	return __builtin_popcount(t);
}
int popcount(ll t){
	return __builtin_popcountll(t);
}
bool ispow2(int i){
	return i&&(i&-i)==i;
}
int mask(int i){
	return (int(1)<<i)-1;
}

bool inc(int a,int b,int c){
	return a<=b&&b<=c;
}

template<class t> void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

ll rand_int(ll l, ll r) { //[l, r]
	#ifdef LOCAL
	static mt19937_64 gen;
	#else
    static random_device rd;
    static mt19937_64 gen(rd());
    #endif
    return uniform_int_distribution<ll>(l, r)(gen);
}

template<class t>
int lwb(const vc<t>&v,const t&a){
	return lower_bound(all(v),a)-v.bg;
}

void shift(vi&a,const vi&es){
	rng(i,1,si(es))
		swap(a[es[0]],a[es[i]]);
}

vvc<int> slv1(vi a){
	int n=si(a);

	vi b=a;
	sort(all(b));
	vi idx(n);
	int pre=-1,cur=-1;
	rep(i,n){
		if(pre<b[i]){
			cur++;
			pre=b[i];
		}
		idx[i]=cur;
	}
	int s=cur+1;
	vvc<pi> g(s);
	rep(i,n){
		int x=idx[i];
		int y=idx[lwb(b,a[i])];
		if(x!=y){
			g[x].eb(y,i);
		}
	}
	vi head(s);
	auto dfs=[&](auto self,int v,vi&dst)->void{
		while(head[v]<si(g[v])){
			int to,e;tie(to,e)=g[v][head[v]++];
			self(self,to,dst);
			dst.pb(e);
		}
	};
	vvc<int> ans;
	int sum=0;
	rep(i,s){
		vi es;
		dfs(dfs,i,es);
		if(si(es)){
			reverse(all(es));
			ans.pb(es);
			sum+=si(es);
		}
	}
	for(auto es:ans){
		shift(a,es);
	}
	dmp(a);
	assert(is_sorted(all(a)));

	return ans;
}

void answer(vvc<int> ans,int lim){
	int sum=0;
	for(auto es:ans)sum+=si(es);
	if(sum<=lim){
		print(ans.size());
		for(auto es:ans){
			for(auto&e:es)e++;
			print(si(es));
			print(es);
		}
	}else{
		print(-1);
	}
	exit(0);
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);

	int n,lim;
	cin>>n;
	bool dbg=n<0;
	if(dbg){
		n=-n;
		lim=n;
	}else
		cin>>lim;
	//cin>>n>>lim;

	vi a;
	if(dbg){
		a.resize(n);
		rep(i,n)a[i]=rand_int(1,2);
	}else{
		a=readvi(n);
	}
	dmp(a);

	vi org=a;

	auto ans=slv1(a);

	int sum=0;
	for(auto es:ans)sum+=si(es);
	int aff=lim-sum;
	if(aff<0){
		print(-1);
		return 0;
	}
	chmin(aff,si(ans));
	if(aff>=3){
		vi z;
		rep(i,aff)
			z.pb(ans[i][0]);
		shift(a,z);

		ans=slv1(a);
		vvc<int> res{z};
		for(auto es:ans)res.pb(es);

		for(auto es:res){
			shift(org,es);
		}
		dmp(org);
		assert(is_sorted(all(org)));

		answer(res,lim);
	}else{
		answer(ans,lim);
	}
}


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

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

#define mp make_pair
#define mt make_tuple
#define one(x) memset(x,-1,sizeof(x))
#define zero(x) memset(x,0,sizeof(x))
#ifdef LOCAL
void dmpr(ostream&os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ";
	dmpr(os,args...);
}
#define dmp2(...) dmpr(cerr,__LINE__,##__VA_ARGS__)
#else
#define dmp2(...) void(0)
#endif

using uint=unsigned;
using ull=unsigned long long;

template<class t,size_t n>
ostream& operator<<(ostream&os,const array<t,n>&a){
	return os<<vc<t>(all(a));
}

template<int i,class T>
void print_tuple(ostream&,const T&){
}

template<int i,class T,class H,class ...Args>
void print_tuple(ostream&os,const T&t){
	if(i)os<<",";
	os<<get<i>(t);
	print_tuple<i+1,T,Args...>(os,t);
}

template<class ...Args>
ostream& operator<<(ostream&os,const tuple<Args...>&t){
	os<<"{";
	print_tuple<0,tuple<Args...>,Args...>(os,t);
	return os<<"}";
}

template<class t>
void print(t x,int suc=1){
	cout<<x;
	if(suc==1)
		cout<<"\n";
	if(suc==2)
		cout<<" ";
}

ll read(){
	ll i;
	cin>>i;
	return i;
}

vi readvi(int n,int off=0){
	vi v(n);
	rep(i,n)v[i]=read()+off;
	return v;
}

template<class T>
void print(const vector<T>&v,int suc=1){
	rep(i,v.size())
		print(v[i],i==int(v.size())-1?suc:2);
}

string readString(){
	string s;
	cin>>s;
	return s;
}

template<class T>
T sq(const T& t){
	return t*t;
}

//#define CAPITAL
void yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<"\n";
	#else
	cout<<"Yes"<<"\n";
	#endif
	if(ex)exit(0);
}
void no(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<"\n";
	#else
	cout<<"No"<<"\n";
	#endif
	if(ex)exit(0);
}
void possible(bool ex=true){
	#ifdef CAPITAL
	cout<<"POSSIBLE"<<"\n";
	#else
	cout<<"Possible"<<"\n";
	#endif
	if(ex)exit(0);
}
void impossible(bool ex=true){
	#ifdef CAPITAL
	cout<<"IMPOSSIBLE"<<"\n";
	#else
	cout<<"Impossible"<<"\n";
	#endif
	if(ex)exit(0);
}

constexpr ll ten(int n){
	return n==0?1:ten(n-1)*10;
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

int topbit(signed t){
	return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
	return t==0?-1:63-__builtin_clzll(t);
}
int botbit(signed a){
	return a==0?32:__builtin_ctz(a);
}
int botbit(ll a){
	return a==0?64:__builtin_ctzll(a);
}
int popcount(signed t){
	return __builtin_popcount(t);
}
int popcount(ll t){
	return __builtin_popcountll(t);
}
bool ispow2(int i){
	return i&&(i&-i)==i;
}
int mask(int i){
	return (int(1)<<i)-1;
}

bool inc(int a,int b,int c){
	return a<=b&&b<=c;
}

template<class t> void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

ll rand_int(ll l, ll r) { //[l, r]
	#ifdef LOCAL
	static mt19937_64 gen;
	#else
    static random_device rd;
    static mt19937_64 gen(rd());
    #endif
    return uniform_int_distribution<ll>(l, r)(gen);
}

template<class t>
int lwb(const vc<t>&v,const t&a){
	return lower_bound(all(v),a)-v.bg;
}

void shift(vi&a,const vi&es){
	rng(i,1,si(es))
		swap(a[es[0]],a[es[i]]);
}

vvc<int> slv1(vi a){
	int n=si(a);

	vi b=a;
	sort(all(b));
	vi idx(n);
	int pre=-1,cur=-1;
	rep(i,n){
		if(pre<b[i]){
			cur++;
			pre=b[i];
		}
		idx[i]=cur;
	}
	int s=cur+1;
	vvc<pi> g(s);
	rep(i,n){
		int x=idx[i];
		int y=idx[lwb(b,a[i])];
		if(x!=y){
			g[x].eb(y,i);
		}
	}
	vi head(s);
	auto dfs=[&](auto self,int v,vi&dst)->void{
		while(head[v]<si(g[v])){
			int to,e;tie(to,e)=g[v][head[v]++];
			self(self,to,dst);
			dst.pb(e);
		}
	};
	vvc<int> ans;
	int sum=0;
	rep(i,s){
		vi es;
		dfs(dfs,i,es);
		if(si(es)){
			reverse(all(es));
			ans.pb(es);
			sum+=si(es);
		}
	}
	for(auto es:ans){
		shift(a,es);
	}
	dmp(a);
	assert(is_sorted(all(a)));

	return ans;
}

void answer(vvc<int> ans,int lim){
	int sum=0;
	for(auto es:ans)sum+=si(es);
	if(sum<=lim){
		print(ans.size());
		for(auto es:ans){
			for(auto&e:es)e++;
			print(si(es));
			print(es);
		}
	}else{
		print(-1);
	}
	exit(0);
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);

	int n,lim;
	cin>>n;
	bool dbg=n<0;
	if(dbg){
		n=-n;
		lim=n;
	}else
		cin>>lim;
	//cin>>n>>lim;

	vi a;
	if(dbg){
		a.resize(n);
		rep(i,n)a[i]=rand_int(1,2);
	}else{
		a=readvi(n);
	}
	dmp(a);

	vi org=a;

	auto ans=slv1(a);

	if(ans.size()<=2){
		answer(ans,lim);
	}

	vi z;
	for(auto es:ans)
		z.pb(es[0]);
	shift(a,z);

	ans=slv1(a);
	assert(si(ans)<=1);
	vvc<int> res{z};
	for(auto es:ans)res.pb(es);

	for(auto es:res){
		shift(org,es);
	}
	dmp(org);
	assert(is_sorted(all(org)));

	answer(res,lim);
}


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

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

#define mp make_pair
#define mt make_tuple
#define one(x) memset(x,-1,sizeof(x))
#define zero(x) memset(x,0,sizeof(x))
#ifdef LOCAL
void dmpr(ostream&os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ";
	dmpr(os,args...);
}
#define dmp2(...) dmpr(cerr,__LINE__,##__VA_ARGS__)
#else
#define dmp2(...) void(0)
#endif

using uint=unsigned;
using ull=unsigned long long;

template<class t,size_t n>
ostream& operator<<(ostream&os,const array<t,n>&a){
	return os<<vc<t>(all(a));
}

template<int i,class T>
void print_tuple(ostream&,const T&){
}

template<int i,class T,class H,class ...Args>
void print_tuple(ostream&os,const T&t){
	if(i)os<<",";
	os<<get<i>(t);
	print_tuple<i+1,T,Args...>(os,t);
}

template<class ...Args>
ostream& operator<<(ostream&os,const tuple<Args...>&t){
	os<<"{";
	print_tuple<0,tuple<Args...>,Args...>(os,t);
	return os<<"}";
}

template<class t>
void print(t x,int suc=1){
	cout<<x;
	if(suc==1)
		cout<<"\n";
	if(suc==2)
		cout<<" ";
}

ll read(){
	ll i;
	cin>>i;
	return i;
}

vi readvi(int n,int off=0){
	vi v(n);
	rep(i,n)v[i]=read()+off;
	return v;
}

template<class T>
void print(const vector<T>&v,int suc=1){
	rep(i,v.size())
		print(v[i],i==int(v.size())-1?suc:2);
}

string readString(){
	string s;
	cin>>s;
	return s;
}

template<class T>
T sq(const T& t){
	return t*t;
}

//#define CAPITAL
void yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<"\n";
	#else
	cout<<"Yes"<<"\n";
	#endif
	if(ex)exit(0);
}
void no(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<"\n";
	#else
	cout<<"No"<<"\n";
	#endif
	if(ex)exit(0);
}
void possible(bool ex=true){
	#ifdef CAPITAL
	cout<<"POSSIBLE"<<"\n";
	#else
	cout<<"Possible"<<"\n";
	#endif
	if(ex)exit(0);
}
void impossible(bool ex=true){
	#ifdef CAPITAL
	cout<<"IMPOSSIBLE"<<"\n";
	#else
	cout<<"Impossible"<<"\n";
	#endif
	if(ex)exit(0);
}

constexpr ll ten(int n){
	return n==0?1:ten(n-1)*10;
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

int topbit(signed t){
	return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
	return t==0?-1:63-__builtin_clzll(t);
}
int botbit(signed a){
	return a==0?32:__builtin_ctz(a);
}
int botbit(ll a){
	return a==0?64:__builtin_ctzll(a);
}
int popcount(signed t){
	return __builtin_popcount(t);
}
int popcount(ll t){
	return __builtin_popcountll(t);
}
bool ispow2(int i){
	return i&&(i&-i)==i;
}
int mask(int i){
	return (int(1)<<i)-1;
}

bool inc(int a,int b,int c){
	return a<=b&&b<=c;
}

template<class t> void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

ll rand_int(ll l, ll r) { //[l, r]
	#ifdef LOCAL
	static mt19937_64 gen;
	#else
    static random_device rd;
    static mt19937_64 gen(rd());
    #endif
    return uniform_int_distribution<ll>(l, r)(gen);
}

template<class t>
int lwb(const vc<t>&v,const t&a){
	return lower_bound(all(v),a)-v.bg;
}

void shift(vi&a,const vi&es){
	rng(i,1,si(es))
		swap(a[es[0]],a[es[i]]);
}

vvc<int> slv1(vi a){
	int n=si(a);

	vi b=a;
	sort(all(b));
	vi idx(n);
	int pre=-1,cur=-1;
	rep(i,n){
		if(pre<b[i]){
			cur++;
			pre=b[i];
		}
		idx[i]=cur;
	}
	int s=cur+1;
	vvc<pi> g(s);
	rep(i,n){
		int x=idx[i];
		int y=idx[lwb(b,a[i])];
		if(x!=y){
			g[x].eb(y,i);
		}
	}
	vi head(s);
	auto dfs=[&](auto self,int v,vi&dst)->void{
		while(head[v]<si(g[v])){
			int to,e;tie(to,e)=g[v][head[v]++];
			self(self,to,dst);
			dst.pb(e);
		}
	};
	vvc<int> ans;
	int sum=0;
	rep(i,s){
		vi es;
		dfs(dfs,i,es);
		if(si(es)){
			reverse(all(es));
			ans.pb(es);
			sum+=si(es);
		}
	}
	for(auto es:ans){
		shift(a,es);
	}
	dmp(a);
	assert(is_sorted(all(a)));

	return ans;
}

void answer(vvc<int> ans,int lim){
	int sum=0;
	for(auto es:ans)sum+=si(es);
	if(sum<=lim){
		print(ans.size());
		for(auto es:ans){
			for(auto&e:es)e++;
			print(si(es));
			print(es);
		}
	}else{
		print(-1);
	}
	exit(0);
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);

	int n,lim;
	cin>>n;
	bool dbg=n<0;
	if(dbg){
		n=-n;
		lim=n;
	}else
		cin>>lim;
	//cin>>n>>lim;

	vi a;
	if(dbg){
		a.resize(n);
		rep(i,n)a[i]=rand_int(1,2);
	}else{
		a=readvi(n);
	}
	dmp(a);

	auto ans=slv1(a);

	if(ans.size()<=2){
		answer(ans,lim);
	}

	vi z;
	for(auto es:ans)
		z.pb(es[0]);
	shift(a,z);

	ans=slv1(a);
	assert(si(ans)<=1);
	vvc<int> res{z};
	for(auto es:ans)res.pb(es);
	answer(res,lim);
}


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

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

#define mp make_pair
#define mt make_tuple
#define one(x) memset(x,-1,sizeof(x))
#define zero(x) memset(x,0,sizeof(x))
#ifdef LOCAL
void dmpr(ostream&os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ";
	dmpr(os,args...);
}
#define dmp2(...) dmpr(cerr,__LINE__,##__VA_ARGS__)
#else
#define dmp2(...) void(0)
#endif

using uint=unsigned;
using ull=unsigned long long;

template<class t,size_t n>
ostream& operator<<(ostream&os,const array<t,n>&a){
	return os<<vc<t>(all(a));
}

template<int i,class T>
void print_tuple(ostream&,const T&){
}

template<int i,class T,class H,class ...Args>
void print_tuple(ostream&os,const T&t){
	if(i)os<<",";
	os<<get<i>(t);
	print_tuple<i+1,T,Args...>(os,t);
}

template<class ...Args>
ostream& operator<<(ostream&os,const tuple<Args...>&t){
	os<<"{";
	print_tuple<0,tuple<Args...>,Args...>(os,t);
	return os<<"}";
}

template<class t>
void print(t x,int suc=1){
	cout<<x;
	if(suc==1)
		cout<<"\n";
	if(suc==2)
		cout<<" ";
}

ll read(){
	ll i;
	cin>>i;
	return i;
}

vi readvi(int n,int off=0){
	vi v(n);
	rep(i,n)v[i]=read()+off;
	return v;
}

template<class T>
void print(const vector<T>&v,int suc=1){
	rep(i,v.size())
		print(v[i],i==int(v.size())-1?suc:2);
}

string readString(){
	string s;
	cin>>s;
	return s;
}

template<class T>
T sq(const T& t){
	return t*t;
}

//#define CAPITAL
void yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<"\n";
	#else
	cout<<"Yes"<<"\n";
	#endif
	if(ex)exit(0);
}
void no(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<"\n";
	#else
	cout<<"No"<<"\n";
	#endif
	if(ex)exit(0);
}
void possible(bool ex=true){
	#ifdef CAPITAL
	cout<<"POSSIBLE"<<"\n";
	#else
	cout<<"Possible"<<"\n";
	#endif
	if(ex)exit(0);
}
void impossible(bool ex=true){
	#ifdef CAPITAL
	cout<<"IMPOSSIBLE"<<"\n";
	#else
	cout<<"Impossible"<<"\n";
	#endif
	if(ex)exit(0);
}

constexpr ll ten(int n){
	return n==0?1:ten(n-1)*10;
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

int topbit(signed t){
	return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
	return t==0?-1:63-__builtin_clzll(t);
}
int botbit(signed a){
	return a==0?32:__builtin_ctz(a);
}
int botbit(ll a){
	return a==0?64:__builtin_ctzll(a);
}
int popcount(signed t){
	return __builtin_popcount(t);
}
int popcount(ll t){
	return __builtin_popcountll(t);
}
bool ispow2(int i){
	return i&&(i&-i)==i;
}
int mask(int i){
	return (int(1)<<i)-1;
}

bool inc(int a,int b,int c){
	return a<=b&&b<=c;
}

template<class t> void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

ll rand_int(ll l, ll r) { //[l, r]
	#ifdef LOCAL
	static mt19937_64 gen;
	#else
    static random_device rd;
    static mt19937_64 gen(rd());
    #endif
    return uniform_int_distribution<ll>(l, r)(gen);
}

template<class t>
int lwb(const vc<t>&v,const t&a){
	return lower_bound(all(v),a)-v.bg;
}

void shift(vi&a,const vi&es){
	rng(i,1,si(es))
		swap(a[es[0]],a[es[i]]);
}

vvc<int> slv1(vi a){
	int n=si(a);

	vi b=a;
	sort(all(b));
	vi idx(n);
	int pre=-1,cur=-1;
	rep(i,n){
		if(pre<b[i]){
			cur++;
			pre=b[i];
		}
		idx[i]=cur;
	}
	int s=cur+1;
	vvc<pi> g(s);
	rep(i,n){
		int x=idx[i];
		int y=idx[lwb(b,a[i])];
		if(x!=y){
			g[x].eb(y,i);
		}
	}
	vi head(s);
	auto dfs=[&](auto self,int v,vi&dst)->void{
		while(head[v]<si(g[v])){
			int to,e;tie(to,e)=g[v][head[v]++];
			self(self,to,dst);
			dst.pb(e);
		}
	};
	vvc<int> ans;
	int sum=0;
	rep(i,s){
		vi es;
		dfs(dfs,i,es);
		if(si(es)){
			reverse(all(es));
			ans.pb(es);
			sum+=si(es);
		}
	}
	for(auto es:ans){
		shift(a,es);
	}
	dmp(a);
	assert(is_sorted(all(a)));

	return ans;
}

void answer(vvc<int> ans,int lim){
	int sum=0;
	for(auto es:ans)sum+=si(es);
	if(sum<=lim){
		print(ans.size());
		for(auto es:ans){
			for(auto&e:es)e++;
			print(si(es));
			print(es);
		}
	}else{
		print(-1);
	}
	exit(0);
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);

	int n,lim;
	cin>>n;
	bool dbg=n<0;
	if(dbg){
		n=-n;
		lim=n;
	}else
		cin>>lim;
	//cin>>n>>lim;

	vi a;
	if(dbg){
		a.resize(n);
		rep(i,n)a[i]=rand_int(1,2);
	}else{
		a=readvi(n);
	}
	dmp(a);

	auto ans=slv1(a);

	if(ans.size()<=1){
		answer(ans,lim);
	}

	vi z;
	for(auto es:ans)
		z.pb(es[0]);
	shift(a,z);

	ans=slv1(a);
	assert(si(ans)<=1);
	vvc<int> res{z};
	for(auto es:ans)res.pb(es);
	answer(res,lim);
}


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

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

#define mp make_pair
#define mt make_tuple
#define one(x) memset(x,-1,sizeof(x))
#define zero(x) memset(x,0,sizeof(x))
#ifdef LOCAL
void dmpr(ostream&os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ";
	dmpr(os,args...);
}
#define dmp2(...) dmpr(cerr,__LINE__,##__VA_ARGS__)
#else
#define dmp2(...) void(0)
#endif

using uint=unsigned;
using ull=unsigned long long;

template<class t,size_t n>
ostream& operator<<(ostream&os,const array<t,n>&a){
	return os<<vc<t>(all(a));
}

template<int i,class T>
void print_tuple(ostream&,const T&){
}

template<int i,class T,class H,class ...Args>
void print_tuple(ostream&os,const T&t){
	if(i)os<<",";
	os<<get<i>(t);
	print_tuple<i+1,T,Args...>(os,t);
}

template<class ...Args>
ostream& operator<<(ostream&os,const tuple<Args...>&t){
	os<<"{";
	print_tuple<0,tuple<Args...>,Args...>(os,t);
	return os<<"}";
}

template<class t>
void print(t x,int suc=1){
	cout<<x;
	if(suc==1)
		cout<<"\n";
	if(suc==2)
		cout<<" ";
}

ll read(){
	ll i;
	cin>>i;
	return i;
}

vi readvi(int n,int off=0){
	vi v(n);
	rep(i,n)v[i]=read()+off;
	return v;
}

template<class T>
void print(const vector<T>&v,int suc=1){
	rep(i,v.size())
		print(v[i],i==int(v.size())-1?suc:2);
}

string readString(){
	string s;
	cin>>s;
	return s;
}

template<class T>
T sq(const T& t){
	return t*t;
}

//#define CAPITAL
void yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<"\n";
	#else
	cout<<"Yes"<<"\n";
	#endif
	if(ex)exit(0);
}
void no(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<"\n";
	#else
	cout<<"No"<<"\n";
	#endif
	if(ex)exit(0);
}
void possible(bool ex=true){
	#ifdef CAPITAL
	cout<<"POSSIBLE"<<"\n";
	#else
	cout<<"Possible"<<"\n";
	#endif
	if(ex)exit(0);
}
void impossible(bool ex=true){
	#ifdef CAPITAL
	cout<<"IMPOSSIBLE"<<"\n";
	#else
	cout<<"Impossible"<<"\n";
	#endif
	if(ex)exit(0);
}

constexpr ll ten(int n){
	return n==0?1:ten(n-1)*10;
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

int topbit(signed t){
	return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
	return t==0?-1:63-__builtin_clzll(t);
}
int botbit(signed a){
	return a==0?32:__builtin_ctz(a);
}
int botbit(ll a){
	return a==0?64:__builtin_ctzll(a);
}
int popcount(signed t){
	return __builtin_popcount(t);
}
int popcount(ll t){
	return __builtin_popcountll(t);
}
bool ispow2(int i){
	return i&&(i&-i)==i;
}
int mask(int i){
	return (int(1)<<i)-1;
}

bool inc(int a,int b,int c){
	return a<=b&&b<=c;
}

template<class t> void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

ll rand_int(ll l, ll r) { //[l, r]
	#ifdef LOCAL
	static mt19937_64 gen;
	#else
    static random_device rd;
    static mt19937_64 gen(rd());
    #endif
    return uniform_int_distribution<ll>(l, r)(gen);
}

template<class t>
int lwb(const vc<t>&v,const t&a){
	return lower_bound(all(v),a)-v.bg;
}

void shift(vi&a,const vi&es){
	rng(i,1,si(es))
		swap(a[es[0]],a[es[i]]);
}

vvc<int> slv1(vi a){
	int n=si(a);

	vi b=a;
	sort(all(b));
	vi idx(n);
	int pre=-1,cur=-1;
	rep(i,n){
		if(pre<b[i]){
			cur++;
			pre=b[i];
		}
		idx[i]=cur;
	}
	int s=cur+1;
	vvc<pi> g(s);
	rep(i,n){
		int x=idx[i];
		int y=idx[lwb(b,a[i])];
		if(x!=y){
			g[x].eb(y,i);
		}
	}
	vi head(s);
	auto dfs=[&](auto self,int v,vi&dst)->void{
		while(head[v]<si(g[v])){
			int to,e;tie(to,e)=g[v][head[v]++];
			self(self,to,dst);
			dst.pb(e);
		}
	};
	vvc<int> ans;
	int sum=0;
	rep(i,s){
		vi es;
		dfs(dfs,i,es);
		if(si(es)){
			reverse(all(es));
			ans.pb(es);
			sum+=si(es);
		}
	}
	for(auto es:ans){
		shift(a,es);
	}
	dmp(a);
	assert(is_sorted(all(a)));

	return ans;
}

void answer(vvc<int> ans,int lim){
	int sum=0;
	for(auto es:ans)sum+=si(es);
	if(sum<=lim){
		print(ans.size());
		for(auto es:ans){
			for(auto&e:es)e++;
			print(si(es));
			print(es);
		}
	}else{
		print(-1);
	}
	exit(0);
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);

	int n,lim;
	cin>>n;
	bool dbg=n<0;
	if(dbg){
		n=-n;
		lim=n;
	}else
		cin>>lim;
	//cin>>n>>lim;

	vi a;
	if(dbg){
		a.resize(n);
		rep(i,n)a[i]=rand_int(1,2);
	}else{
		a=readvi(n);
	}
	dmp(a);

	auto ans=slv1(a);

	if(ans.size()<=2){
		answer(ans,lim);
	}

	assert(false);

	vi z;
	for(auto es:ans)
		z.pb(es[0]);
	shift(a,z);

	ans=slv1(a);
	assert(si(ans)<=1);
	vvc<int> res{z};
	for(auto es:ans)res.pb(es);
	answer(res,lim);
}


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

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

#define mp make_pair
#define mt make_tuple
#define one(x) memset(x,-1,sizeof(x))
#define zero(x) memset(x,0,sizeof(x))
#ifdef LOCAL
void dmpr(ostream&os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ";
	dmpr(os,args...);
}
#define dmp2(...) dmpr(cerr,__LINE__,##__VA_ARGS__)
#else
#define dmp2(...) void(0)
#endif

using uint=unsigned;
using ull=unsigned long long;

template<class t,size_t n>
ostream& operator<<(ostream&os,const array<t,n>&a){
	return os<<vc<t>(all(a));
}

template<int i,class T>
void print_tuple(ostream&,const T&){
}

template<int i,class T,class H,class ...Args>
void print_tuple(ostream&os,const T&t){
	if(i)os<<",";
	os<<get<i>(t);
	print_tuple<i+1,T,Args...>(os,t);
}

template<class ...Args>
ostream& operator<<(ostream&os,const tuple<Args...>&t){
	os<<"{";
	print_tuple<0,tuple<Args...>,Args...>(os,t);
	return os<<"}";
}

template<class t>
void print(t x,int suc=1){
	cout<<x;
	if(suc==1)
		cout<<"\n";
	if(suc==2)
		cout<<" ";
}

ll read(){
	ll i;
	cin>>i;
	return i;
}

vi readvi(int n,int off=0){
	vi v(n);
	rep(i,n)v[i]=read()+off;
	return v;
}

template<class T>
void print(const vector<T>&v,int suc=1){
	rep(i,v.size())
		print(v[i],i==int(v.size())-1?suc:2);
}

string readString(){
	string s;
	cin>>s;
	return s;
}

template<class T>
T sq(const T& t){
	return t*t;
}

//#define CAPITAL
void yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<"\n";
	#else
	cout<<"Yes"<<"\n";
	#endif
	if(ex)exit(0);
}
void no(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<"\n";
	#else
	cout<<"No"<<"\n";
	#endif
	if(ex)exit(0);
}
void possible(bool ex=true){
	#ifdef CAPITAL
	cout<<"POSSIBLE"<<"\n";
	#else
	cout<<"Possible"<<"\n";
	#endif
	if(ex)exit(0);
}
void impossible(bool ex=true){
	#ifdef CAPITAL
	cout<<"IMPOSSIBLE"<<"\n";
	#else
	cout<<"Impossible"<<"\n";
	#endif
	if(ex)exit(0);
}

constexpr ll ten(int n){
	return n==0?1:ten(n-1)*10;
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

int topbit(signed t){
	return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
	return t==0?-1:63-__builtin_clzll(t);
}
int botbit(signed a){
	return a==0?32:__builtin_ctz(a);
}
int botbit(ll a){
	return a==0?64:__builtin_ctzll(a);
}
int popcount(signed t){
	return __builtin_popcount(t);
}
int popcount(ll t){
	return __builtin_popcountll(t);
}
bool ispow2(int i){
	return i&&(i&-i)==i;
}
int mask(int i){
	return (int(1)<<i)-1;
}

bool inc(int a,int b,int c){
	return a<=b&&b<=c;
}

template<class t> void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

ll rand_int(ll l, ll r) { //[l, r]
	#ifdef LOCAL
	static mt19937_64 gen;
	#else
    static random_device rd;
    static mt19937_64 gen(rd());
    #endif
    return uniform_int_distribution<ll>(l, r)(gen);
}

template<class t>
int lwb(const vc<t>&v,const t&a){
	return lower_bound(all(v),a)-v.bg;
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);

	int n,lim;cin>>n>>lim;

	vi a=readvi(n);
	vi b=a;
	sort(all(b));
	vi idx(n);
	int pre=-1,cur=-1;
	rep(i,n){
		if(pre<b[i]){
			cur++;
			pre=b[i];
		}
		idx[i]=cur;
	}
	int s=cur+1;
	vvc<pi> g(s);
	rep(i,n){
		int x=idx[i];
		int y=idx[lwb(b,a[i])];
		if(x!=y){
			g[x].eb(y,i);
		}
	}
	vi head(s);
	auto dfs=[&](auto self,int v,vi&dst)->void{
		while(head[v]<si(g[v])){
			int to,e;tie(to,e)=g[v][head[v]++];
			self(self,to,dst);
			dst.pb(e);
		}
	};
	vvc<int> ans;
	int sum=0;
	rep(i,s){
		vi es;
		dfs(dfs,i,es);
		if(si(es)){
			reverse(all(es));
			ans.pb(es);
			sum+=si(es);
		}
	}
	if(sum<=lim){
		print(ans.size());
		for(auto es:ans){
			rng(i,1,si(es)){
				swap(a[es[0]],a[es[i]]);
			}
			for(auto&e:es)e++;
			print(si(es));
			print(es);
		}
		dmp(a);
		assert(is_sorted(all(a)));
	}else{
		print(-1);
	}
}


#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;
}


//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
#ifndef LOCAL
#define cerr if(0)cout
#endif
typedef long long ll;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c<=32)c=_buff.get();return c;}
ll qpow(ll x,ll k){return k==0?1:1ll*qpow(1ll*x*x%mod,k>>1)*(k&1?x:1)%mod;}
const int maxn=200111;
int n,m,tot;
int a[maxn],b[maxn],it[maxn];
map<int,int> mpid;
vector<pair<int,int> > con[maxn];
vector<vector<int>> cyc,ans;
vector<int> cur;
void dfs(int x)
{
	for(int &i=it[x];i<con[x].size();)
	{
		int u=con[x][i].FF,id=con[x][i].SS;
		i++;
		dfs(u);
		cur.PB(id);
	}
}
int main()
{
	getii(n,m);
	for(int i=1;i<=n;i++)
	{
		geti(a[i]);
		b[i]=a[i];
	}
	sort(b+1,b+n+1);
	for(int i=1;i<=n;i++)
	{
		int &id=mpid[b[i]];
		if(id==0)id=++tot;
		b[i]=id;
	}
	for(int i=1;i<=n;i++)a[i]=mpid[a[i]];
	for(int i=1;i<=n;i++)
	{
		if(a[i]==b[i])continue;
		con[a[i]].PB(MP(b[i],i));
	}
	for(int i=1;i<=tot;i++)it[i]=0;
	int sum=0;
	for(int i=1;i<=tot;i++)
	{
		if(con[i].size()>0&&it[i]<con[i].size())
		{
			cur.clear();
			dfs(i);
			cyc.PB(cur);
			sum+=cur.size();
		}
	}
	if(sum>m)
	{
		puts("-1");
		return 0;
	}
	int mx=-1;
	for(int i=1;i<cyc.size();i++)
	{
		if(sum+1+i<=m)
		{
			mx=i;
		}
	}
	if(mx!=-1)
	{
		vector<int> v;
		for(int i=0;i<=mx;i++)
		{
			for(int j=0;j<cyc[i].size();j++)
			{
				v.PB(cyc[i][j]);
			}
		}
		ans.PB(v);
		v.clear();
		for(int i=0;i<=mx;i++)v.PB(cyc[i][0]);
		reverse(v.begin(),v.end());
		ans.PB(v);
	}
	else
	{
		for(int i=0;i<=mx;i++)ans.PB(cyc[i]);
	}
	for(int i=mx+1;i<cyc.size();i++)ans.PB(cyc[i]);
	putsi(ans.size());
	for(int i=0;i<ans.size();i++)
	{
		putsi(ans[i].size());
		for(auto x:ans[i])puti(x);puts("");
	}
	return 0;
}


//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
#ifndef LOCAL
#define cerr if(0)cout
#endif
typedef long long ll;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c<=32)c=_buff.get();return c;}
ll qpow(ll x,ll k){return k==0?1:1ll*qpow(1ll*x*x%mod,k>>1)*(k&1?x:1)%mod;}
const int maxn=100111;
int n,m,tot;
int a[maxn],b[maxn],it[maxn];
map<int,int> mpid;
vector<pair<int,int> > con[maxn];
vector<vector<int>> cyc,ans;
vector<int> cur;
void dfs(int x)
{
	for(int &i=it[x];i<con[x].size();)
	{
		int u=con[x][i].FF,id=con[x][i].SS;
		i++;
		dfs(u);
		cur.PB(id);
	}
}
int main()
{
	getii(n,m);
	for(int i=1;i<=n;i++)
	{
		geti(a[i]);
		b[i]=a[i];
	}
	sort(b+1,b+n+1);
	for(int i=1;i<=n;i++)
	{
		int &id=mpid[b[i]];
		if(id==0)id=++tot;
		b[i]=id;
	}
	for(int i=1;i<=n;i++)a[i]=mpid[a[i]];
	for(int i=1;i<=n;i++)
	{
		if(a[i]==b[i])continue;
		con[a[i]].PB(MP(b[i],i));
	}
	for(int i=1;i<=tot;i++)it[i]=0;
	int sum=0;
	for(int i=1;i<=tot;i++)
	{
		if(con[i].size()>0&&it[i]<con[i].size())
		{
			cur.clear();
			dfs(i);
			cyc.PB(cur);
			sum+=cur.size();
		}
	}
	if(sum>m)
	{
		puts("-1");
		return 0;
	}
	int mx=-1;
	for(int i=1;i<cyc.size();i++)
	{
		if(sum+1+i<=m)
		{
			mx=i;
		}
	}
	if(mx!=-1)
	{
		vector<int> v;
		for(int i=0;i<=mx;i++)
		{
			for(int j=0;j<cyc[i].size();j++)
			{
				v.PB(cyc[i][j]);
			}
		}
		ans.PB(v);
		v.clear();
		for(int i=0;i<=mx;i++)v.PB(cyc[i][0]);
		reverse(v.begin(),v.end());
		ans.PB(v);
	}
	else
	{
		for(int i=0;i<=mx;i++)ans.PB(cyc[i]);
	}
	for(int i=mx+1;i<cyc.size();i++)ans.PB(cyc[i]);
	putsi(ans.size());
	for(int i=0;i<ans.size();i++)
	{
		putsi(ans[i].size());
		for(auto x:ans[i])puti(x);puts("");
	}
	return 0;
}


#include <bits/stdc++.h>

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;

const int MAXN = 300000;

map<int, int> mapa;
map<pair<int, int>, vector<int>> pos;
vector<int> g[MAXN];
int ptr[MAXN];
int used[MAXN];

void euler(int v, vector<int> &res) {
    used[v] = true;
    for (; ptr[v] < sz(g[v]); ) {
        ++ptr[v];
        int u = g[v][ptr[v] - 1];
        euler(u, res);
        res.push_back(u);
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, s;
    cin >> n >> s;
    int k = 0;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<int> b = a;
    sort(all(b));
    int m = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] == b[i]) {
            continue;
        }
        ++m;
        if (!mapa.count(b[i])) {
            mapa[b[i]] = k++;
        }
    }
    if (m > s) {
        cout << -1 << endl;
        return 0;
    }
    for (int i = 0; i < n; ++i) {
        if (a[i] == b[i]) {
            continue;
        }
        a[i] = mapa[a[i]];
        b[i] = mapa[b[i]];
        g[b[i]].push_back(a[i]);
        pos[{b[i], a[i]}].push_back(i);
    }
    vector<vector<int>> cycles;
    for (int i = 0; i < k; ++i) {
        if (!used[i]) {
            vector<int> arr;
            euler(i, arr);
            reverse(all(arr));
            cycles.push_back({});
            for (int i = 0; i < sz(arr); ++i) {
                int j = (i + 1) % sz(arr);
                cycles.back().push_back(pos[{arr[i], arr[j]}].back());
                pos[{arr[i], arr[j]}].pop_back();
            }
        }
    }
    vector<vector<int>> res;
    if (s - m > 1 && sz(cycles) > 1) {
        int len = min(sz(cycles), s - m);
        res.push_back({});
        vector<int> newcycle;
        for (int i = sz(cycles) - len; i < sz(cycles); ++i) {
            res.back().push_back(cycles[i].back());
            for (int j : cycles[i]) {
                newcycle.push_back(j);
            }
        }
        reverse(all(res.back()));
        for (int i = 0; i < len; ++i) {
            cycles.pop_back();
        }
        cycles.push_back(newcycle);
    }

    for (int i = 0; i < sz(cycles); ++i) {
        res.push_back(cycles[i]);
    }
    cout << sz(res) << endl;
    for (int i = 0; i < sz(res); ++i) {
        cout << sz(res[i]) << endl;
        for (int j : res[i]) {
            cout << j + 1 << " ";
        }
        cout << endl;
    }
}


#include <bits/stdc++.h>

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;

const int MAXN = 300000;

map<int, int> mapa;
vector<int> pos[MAXN];
vector<int> g[MAXN];
int ptr[MAXN];
int used[MAXN];

void euler(int v, vector<int> &res) {
    used[v] = true;
    for (; ptr[v] < sz(g[v]); ) {
        ++ptr[v];
        euler(g[v][ptr[v] - 1], res);
    }
    if (sz(pos[v]) > 0) {
        res.push_back(pos[v].back());
        pos[v].pop_back();
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, s;
    cin >> n >> s;
    int k = 0;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<int> b = a;
    sort(all(b));
    int m = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] == b[i]) {
            continue;
        }
        ++m;
        if (!mapa.count(b[i])) {
            mapa[b[i]] = k++;
        }
    }
    if (m > s) {
        cout << -1 << endl;
        return 0;
    }
    for (int i = 0; i < n; ++i) {
        if (a[i] == b[i]) {
            continue;
        }
        a[i] = mapa[a[i]];
        b[i] = mapa[b[i]];
        g[a[i]].push_back(b[i]);
        pos[b[i]].push_back(i);
    }
    vector<vector<int>> cycles;
    for (int i = 0; i < k; ++i) {
        if (!used[i]) {
            cycles.push_back({});
            euler(i, cycles.back());
        }
    }
    vector<vector<int>> res;
    if (s - m > 1 && sz(cycles) > 1) {
        int len = min(sz(cycles), s - m);
        res.push_back({});
        vector<int> newcycle;
        for (int i = sz(cycles) - len; i < sz(cycles); ++i) {
            res.back().push_back(cycles[i].back());
            for (int j : cycles[i]) {
                newcycle.push_back(j);
            }
        }
        for (int i = 0; i < len; ++i) {
            cycles.pop_back();
        }
        cycles.push_back(newcycle);
    }

    for (int i = 0; i < sz(cycles); ++i) {
        res.push_back(cycles[i]);
    }

    cout << sz(res) << endl;

    for (int i = 0; i < sz(res); ++i) {
        cout << sz(res[i]) << endl;
        for (int j : res[i]) {
            cout << j + 1 << " ";
        }
        cout << endl;
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

vector< vector<int> > g;
vector<int> a;
vector<int> b;
vector< vector<int> > cyc;

void dfs(int u) {
  while (!g[u].empty()) {
    int v = g[u].back();
    g[u].pop_back();
    dfs(a[v]);
    cyc.back().push_back(v);
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, s;
  cin >> n >> s;
  g.resize(n);
  a.resize(n);
  b.resize(n);

  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b.begin(), b.end());
  vector<int> tmp = b;
  set<int> st(tmp.begin(), tmp.end());
  tmp.assign(st.begin(), st.end());
  int k = (int) tmp.size();
  for (int i = 0; i < n; i++) {
    a[i] = lower_bound(tmp.begin(), tmp.end(), a[i]) - tmp.begin();
    b[i] = lower_bound(tmp.begin(), tmp.end(), b[i]) - tmp.begin();
  }
  for (int i = 0; i < n; i++) {
    if (a[i] != b[i]) {
      g[b[i]].push_back(i);
    }
  }
  for (int i = 0; i < k; i++) {
    cyc.push_back({});
    dfs(i);
    if (cyc.back().empty()) {
      cyc.pop_back();
    }
  }
  for (auto& v : cyc) {
    s -= (int) v.size();
  }
  if (s < 0) {
    cout << -1 << endl;
    return 0;
  }
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    p[i] = i;
  }
  int m = (int) cyc.size();
  for (auto& v : cyc) {
    for (int i = 0; i < (int) v.size(); i++) {
      p[v[(i + 1) % (int) v.size()]] = v[i];
    }
  }
  vector< vector<int> > ans;
  m = min(m, s);
  if (m > 1) {
    ans.push_back({});
    for (int i = 0; i < m; i++) {
      ans.back().push_back(cyc[i][0]);
    }
    for (int i = m - 1; i > 0; i--) {
      swap(p[cyc[i][0]], p[cyc[i - 1][0]]);
    }
  }
  vector<int> used(n);
  for (int i = 0; i < n; i++) {
    if (used[i] || p[i] == i) {
      used[i] = 1;
      continue;
    }
    ans.push_back({});
    int cur = i;
    while (!used[cur]) {
      ans.back().push_back(cur);
      used[cur] = 1;
      cur = p[cur];
    }
  }
  cout << (int) ans.size() << endl;
  for (auto& v : ans) {
    int first = 1;
    cout << (int) v.size() << endl;
    for (auto& x : v) {
      if (!first) {
        cout << ' ';
      }
      first = 0;
      cout << x + 1;
    }
    cout << endl;
  }
  return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

vector< vector<int> > g;
vector<int> a;
vector<int> b;
vector< vector<int> > cyc;

void dfs(int u) {
  while (!g[u].empty()) {
    int v = g[u].back();
    g[u].pop_back();
    dfs(a[v]);
    cyc.back().push_back(v);
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, s;
  cin >> n >> s;
  g.resize(n);
  a.resize(n);
  b.resize(n);

  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b.begin(), b.end());
  vector<int> tmp = b;
  set<int> st(tmp.begin(), tmp.end());
  tmp.assign(st.begin(), st.end());
  int k = (int) tmp.size();
  for (int i = 0; i < n; i++) {
    a[i] = lower_bound(tmp.begin(), tmp.end(), a[i]) - tmp.begin();
    b[i] = lower_bound(tmp.begin(), tmp.end(), b[i]) - tmp.begin();
  }
  for (int i = 0; i < n; i++) {
    if (a[i] != b[i]) {
      g[b[i]].push_back(i);
    }
  }
  for (int i = 0; i < k; i++) {
    cyc.push_back({});
    dfs(i);
    if (cyc.back().empty()) {
      cyc.pop_back();
    }
  }
  for (auto& v : cyc) {
    s -= (int) v.size();
  }
  if (s < 0) {
    cout << -1 << endl;
    return 0;
  }
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    p[i] = i;
  }
  int m = (int) cyc.size();
  for (auto& v : cyc) {
    for (int i = 0; i < (int) v.size(); i++) {
      p[v[(i + 1) % (int) v.size()]] = v[i];
    }
  }
  vector< vector<int> > ans;
  m = min(m, s);
  if (m > 1) {
    ans.push_back({});
    for (int i = 0; i < m; i++) {
      ans.back().push_back(cyc[i][0]);
    }
    for (int i = m - 1; i > 0; i--) {
      swap(p[cyc[i][0]], p[cyc[i - 1][0]]);
    }
  }
  vector<int> used(n);
  for (int i = 0; i < n; i++) {
    if (used[i] || p[i] == i) {
      used[i] = 1;
      continue;
    }
    ans.push_back({});
    int cur = i;
    while (!used[cur]) {
      ans.back().push_back(cur);
      used[cur] = 1;
      cur = p[cur];
    }
  }
  cout << (int) ans.size() << endl;
  for (auto& v : ans) {
    int first = 1;
    for (auto& x : v) {
      if (!first) {
        cout << ' ';
      }
      first = 0;
      cout << x + 1;
    }
    cout << endl;
  }
  return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

vector< vector<int> > g;
vector<int> was;
vector< vector<int> > ans;

void dfs(int u) {
  was[u] = 1;
  ans.back().push_back(u);
  for (auto& v : g[u]) {
    if (!was[v]) {
      dfs(v);
    }
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, s;
  cin >> n >> s;
  vector<int> a(n + 1);
  vector< pair<int, int> > b(n + 1);
  vector<int> p(n + 1);
  g.resize(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[i] = {a[i], i};
  }
  sort(b.begin() + 1, b.end());
  for (int i = 1; i <= n; i++) {
    p[b[i].second] = i;
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] == b[i].first) {
      continue;
    }
    g[i].push_back(p[i]);
  }
  long long tot = 0ll;
  was.assign(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    if (!was[i]) {
      ans.push_back(vector<int>());
      dfs(i);
      if ((int) ans.back().size() == 1) {
        ans.pop_back();
        continue;
      }
      tot += (long long) ans.back().size();
    }
  }
  if (tot > s) {
    cout << -1 << endl;
    return 0;
  }
  cout << (int) ans.size() << endl;
  for (auto& v : ans) {
    if ((int) v.size() == 1) {
      continue;
    }
    cout << (int) v.size() << endl;
    int first = 1;
    for (auto& x : v) {
      if (!first) {
        cout << ' ';
      }
      first = 0;
      cout << x;
    }
    cout << endl;
  }
  return 0;
}


#include<bits/stdc++.h>
#define Rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define Repe(i,a,b) for(register int i=(a);i>=(b);--i)
#define pb push_back
#define mp make_pair
#define Chkmax(a,b) a=a>b?a:b
#define Chkmin(a,b) a=a<b?a:b
#define mx(a,b) (a>b?a:b)
#define mn(a,b) (a<b?a:b)
typedef unsigned long long uint64;
typedef unsigned int uint32;
typedef long long ll;
using namespace std;

namespace IO
{
    const uint32 Buffsize=1<<15,Output=1<<23;
    static char Ch[Buffsize],*S=Ch,*T=Ch;
    inline char getc()
	{
		return((S==T)&&(T=(S=Ch)+fread(Ch,1,Buffsize,stdin),S==T)?0:*S++);
	}
    static char Out[Output],*nowps=Out;

    inline void flush(){fwrite(Out,1,nowps-Out,stdout);nowps=Out;}

    template<typename T>inline void read(T&x)
	{
		x=0;static char ch;T f=1;
		for(ch=getc();!isdigit(ch);ch=getc())if(ch=='-')f=-1;
		for(;isdigit(ch);ch=getc())x=x*10+(ch^48);
		x*=f;
	}

	template<typename T>inline void write(T x,char ch='\n')
	{
		if(!x)*nowps++='0';
		if(x<0)*nowps++='-',x=-x;
		static uint32 sta[111],tp;
		for(tp=0;x;x/=10)sta[++tp]=x%10;
		for(;tp;*nowps++=sta[tp--]^48);
		*nowps++=ch;
	}
}
using namespace IO;

inline void file()
{
#ifndef ONLINE_JUDGE
	freopen("gen.in","r",stdin);
	freopen("gen.out","w",stdout);
#endif
}

const int MAXN=2e5+7;

static int n,s;
static struct poi
{
	int x,id;
	friend bool operator<(poi a,poi b)
	{return a.x<b.x;}
}a[MAXN];

namespace DSU
{
	static int fa[MAXN];

	inline void cls(){Rep(i,1,n)fa[i]=i;}

	inline int Find(int u)
	{return u==fa[u]?u:fa[u]=Find(fa[u]);}

	void merge(int u,int v)
	{fa[Find(v)]=Find(u);}
}

static int ps[MAXN],nx[MAXN],pr[MAXN];

static int nm[MAXN],tt;

void dfs(int u,int fg=1)
{
	if(fg==1)
	{
		int x=u,sm=0;
		do{++sm;x=nx[x];}while(u^x);
		write(sm);
	}
	else if(!fg)
	{
		int x=u;
		do{++tt;x=nx[x];}while(u^x);
		return;
	}
	int x=u;
	do{write(x,' ');x=nx[x];}while(u^x);
}

inline void init()
{
	read(n);read(s);s-=n;
	DSU::cls();
	Rep(i,1,n)read(a[i].x),a[i].id=nx[i]=i;
}
inline void solve()
{
	sort(a+1,a+n+1);
	Rep(i,1,n)while(a[a[i].id].x==a[i].x
		&&a[i].id^i)swap(a[i],a[a[i].id]);
	Rep(i,1,n)ps[a[i].id]=i;
	static int u;
	Rep(i,1,n)if(nx[i]==i)
	{
		u=i;
		while(1)
		{
			nx[u]=ps[u];
			if(ps[u]==i)break;
			u=ps[u];DSU::merge(u,i);
		}
		if(nx[i]==i)DSU::fa[i]=0,++s;
	}

	for(register int i=1,j;i<=n;i=j+1)
	{
		j=i;
		u=DSU::Find(a[i].id);
		if(!u)continue;
		while(j<n&&a[j+1].x==a[i].x)
		{
			++j;
			if(DSU::Find(a[j].id)==u||!DSU::fa[a[j].id])continue;
			swap(nx[a[i].id],nx[a[j].id]);
			DSU::merge(a[i].id,a[j].id);
		}
	}

	if(s<0)return(void)puts("-1");

	static int tmp;tmp=0;

	Rep(i,1,n)if(DSU::fa[i]==i)nm[++tmp]=i;

	write((s<=1||tmp<=1)?tmp:max(tmp+2-s,2));
	if(s<=1||tmp<=1)Rep(i,1,tmp)dfs(nm[i]),*nowps++='\n';
	else
	{
		u=min(s,tmp);
		Rep(i,1,u)dfs(nm[i],0);
		write(tt);
		Rep(i,1,u)dfs(nm[i],-1);
		*nowps++='\n';
		write(u);
		Repe(i,u,1)write(nm[i],i==1?'\n':' ');
		Rep(i,u+1,tmp)dfs(nm[i]),*nowps++='\n';
	}
	flush();
}

int main()
{
    init();
    solve();
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <sstream>
#include <tuple>
#include <vector>

using namespace std;
using namespace chrono;

#ifdef DEBUG
	#define LOCAL_INPUT_FILE
#else
	//#define USE_FILE_IO
#endif

#ifdef USE_FILE_IO
	#define INPUT_FILE "input.txt"
	#define OUTPUT_FILE "output.txt"
	#define cin ____cin
	#define cout ____cout
	ifstream cin(INPUT_FILE);
	ofstream cout(OUTPUT_FILE);
#else
	#ifdef LOCAL_INPUT_FILE
		#define cin ____cin
		ifstream cin("input.txt");
	#endif
#endif

const int infinity = (int)1e9 + 42;
const int64_t llInfinity = (int64_t)1e18 + 256;
const int module = (int)1e9 + 7;
const long double eps = 1e-8;

mt19937_64 randGen(system_clock().now().time_since_epoch().count());

inline void raiseError(string errorCode) {
	cerr << "Error : " << errorCode << endl;
	exit(42);
}

inline void test(istream &cin, ostream &cout) {
	int n, s; cin >> n >> s;
	vector<int> v(n);
	map<int, int> kompr;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		kompr[v[i]] = 42;
	}
	int k = 0;
	for (auto &it: kompr) {
		it.second = k++;
	}
	for (int i = 0; i < n; i++) {
		v[i] = kompr[v[i]];
	}
	auto w = v;
	sort(w.begin(), w.end());

	vector< vector<int> > g(k);
	map< pair<int, int>, vector<int> > indices;
	for (int i = 0; i < n; i++) {
		if (w[i] == v[i]) {
			continue;
		}
		s--;
		g[w[i]].push_back(v[i]);
		indices[{w[i], v[i]}].push_back(i);
	}
	if (s < 0) {
		cout << -1 << "\n";
		return;
	}

	vector<char> used(n, false);
	function<void(int)> pdfs = [&](int v) {
		if (used[v]) {
			return;
		}
		used[v] = true;
		for (int to: g[v]) {
			pdfs(to);
		}
	};
	int comps = 0;
	for (int i = 0; i < k; i++) {
		if (!used[i]) {
			pdfs(i);
			if (!g[i].empty()) {
				comps++;
			}
		}
	}

	vector<int> pass;
	function<void(int)> dfs = [&](int v) {
		while (!g[v].empty()) {
			int to = g[v].back();
			g[v].pop_back();
			dfs(to);
		}
		pass.push_back(v);
	};

	vector< vector<int> > ans;
	for (int i = 0; i < k; i++) {
		if (g[i].empty()) {
			continue;
		}
		pass.clear();
		dfs(i);
		ans.emplace_back();
		for (int j = 1; j < (int)pass.size(); j++) {
			auto &vec = indices[{pass[j], pass[j-1]}];
			assert(!vec.empty());
			ans.back().push_back(vec.back());
			vec.pop_back();
		}
		reverse(ans.back().begin(), ans.back().end());
	}
	assert((int)ans.size() == comps);

	cout << ans.size() << "\n";
	for (auto vec: ans) {
		cout << vec.size() << "\n";
		for (auto it: vec) {
			cout << it+1 << " ";
		}
		cout << "\n";
	}
}

signed main() {
	#ifndef USE_FILE_IO
		ios_base::sync_with_stdio(false);
	#endif
	test(cin, cout);

	/*int tid = 0;
	mt19937_64 rnd(42);
	for (;;) {
		cout << "Test " << ++tid << endl;
		ostringstream qq;
		int n = rnd() % 20 + 1;
		qq << n << " " << n << endl;
		for (int i = 0; i < n; i++) {
			qq << rnd() % 20 + 1 << " ";
		}
		qq << endl;
		istringstream is(qq.str());
		cout << "Input:" << endl << qq.str();
		cout << "Output:" << endl;
		test(is, cout);
		cout << endl;
	}*/

	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <sstream>
#include <tuple>
#include <vector>

using namespace std;
using namespace chrono;

#ifdef DEBUG
	#define LOCAL_INPUT_FILE
#else
	//#define USE_FILE_IO
#endif

#ifdef USE_FILE_IO
	#define INPUT_FILE "input.txt"
	#define OUTPUT_FILE "output.txt"
	#define cin ____cin
	#define cout ____cout
	ifstream cin(INPUT_FILE);
	ofstream cout(OUTPUT_FILE);
#else
	#ifdef LOCAL_INPUT_FILE
		#define cin ____cin
		ifstream cin("input.txt");
	#endif
#endif

const int infinity = (int)1e9 + 42;
const int64_t llInfinity = (int64_t)1e18 + 256;
const int module = (int)1e9 + 7;
const long double eps = 1e-8;

mt19937_64 randGen(system_clock().now().time_since_epoch().count());

inline void raiseError(string errorCode) {
	cerr << "Error : " << errorCode << endl;
	exit(42);
}

signed main() {
	#ifndef USE_FILE_IO
		ios_base::sync_with_stdio(false);
	#endif
	int n, s; cin >> n >> s;
	vector<int> v(n);
	map<int, int> kompr;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		kompr[v[i]] = 42;
	}
	int k = 0;
	for (auto &it: kompr) {
		it.second = k++;
	}
	for (int i = 0; i < n; i++) {
		v[i] = kompr[v[i]];
	}
	auto w = v;
	sort(w.begin(), w.end());

	vector< vector<int> > g(k);
	map< pair<int, int>, vector<int> > indices;
	for (int i = 0; i < n; i++) {
		if (w[i] == v[i]) {
			continue;
		}
		s--;
		g[w[i]].push_back(v[i]);
		indices[{w[i], v[i]}].push_back(i);
	}
	if (s < 0) {
		cout << -1 << "\n";
		return 0;
	}

	vector<int> pass;
	function<void(int)> dfs = [&](int v) {
		while (!g[v].empty()) {
			int to = g[v].back();
			g[v].pop_back();
			dfs(to);
		}
		pass.push_back(v);
	};

	vector< vector<int> > ans;
	for (int i = 0; i < k; i++) {
		if (g[i].empty()) {
			continue;
		}
		dfs(i);
		ans.emplace_back();
		for (int j = 1; j < (int)pass.size(); j++) {
			auto &vec = indices[{pass[j], pass[j-1]}];
			assert(!vec.empty());
			ans.back().push_back(vec.back());
			vec.pop_back();
		}
	}

	cout << ans.size() << "\n";
	for (auto vec: ans) {
		cout << vec.size() << "\n";
		for (auto it: vec) {
			cout << it+1 << " ";
		}
		cout << "\n";
	}

	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <sstream>
#include <tuple>
#include <vector>

using namespace std;
using namespace chrono;

#ifdef DEBUG
	#define LOCAL_INPUT_FILE
#else
	//#define USE_FILE_IO
#endif

#ifdef USE_FILE_IO
	#define INPUT_FILE "input.txt"
	#define OUTPUT_FILE "output.txt"
	#define cin ____cin
	#define cout ____cout
	ifstream cin(INPUT_FILE);
	ofstream cout(OUTPUT_FILE);
#else
	#ifdef LOCAL_INPUT_FILE
		#define cin ____cin
		ifstream cin("input.txt");
	#endif
#endif

const int infinity = (int)1e9 + 42;
const int64_t llInfinity = (int64_t)1e18 + 256;
const int module = (int)1e9 + 7;
const long double eps = 1e-8;

mt19937_64 randGen(system_clock().now().time_since_epoch().count());

inline void raiseError(string errorCode) {
	cerr << "Error : " << errorCode << endl;
	exit(42);
}

inline void test(istream &cin, ostream &cout) {
	int n, s; cin >> n >> s;
	vector<int> v(n);
	map<int, int> kompr;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		kompr[v[i]] = 42;
	}
	int k = 0;
	for (auto &it: kompr) {
		it.second = k++;
	}
	for (int i = 0; i < n; i++) {
		v[i] = kompr[v[i]];
	}
	auto w = v;
	sort(w.begin(), w.end());

	vector< vector<int> > g(k);
	map< pair<int, int>, vector<int> > indices;
	for (int i = 0; i < n; i++) {
		if (w[i] == v[i]) {
			continue;
		}
		s--;
		g[w[i]].push_back(v[i]);
		indices[{w[i], v[i]}].push_back(i);
	}
	if (s < 0) {
		cout << -1 << "\n";
		return;
	}

	vector<int> pass;
	function<void(int)> dfs = [&](int v) {
		while (!g[v].empty()) {
			int to = g[v].back();
			g[v].pop_back();
			dfs(to);
		}
		pass.push_back(v);
	};

	vector< vector<int> > ans;
	for (int i = 0; i < k; i++) {
		if (g[i].empty()) {
			continue;
		}
		pass.clear();
		dfs(i);
		ans.emplace_back();
		for (int j = 1; j < (int)pass.size(); j++) {
			auto &vec = indices[{pass[j], pass[j-1]}];
			assert(!vec.empty());
			ans.back().push_back(vec.back());
			vec.pop_back();
		}
		reverse(ans.back().begin(), ans.back().end());
	}

	cout << ans.size() << "\n";
	for (auto vec: ans) {
		cout << vec.size() << "\n";
		for (auto it: vec) {
			cout << it+1 << " ";
		}
		cout << "\n";
	}
}

signed main() {
	#ifndef USE_FILE_IO
		ios_base::sync_with_stdio(false);
	#endif
	test(cin, cout);
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <sstream>
#include <tuple>
#include <vector>

using namespace std;
using namespace chrono;

#ifdef DEBUG
	#define LOCAL_INPUT_FILE
#else
	//#define USE_FILE_IO
#endif

#ifdef USE_FILE_IO
	#define INPUT_FILE "input.txt"
	#define OUTPUT_FILE "output.txt"
	#define cin ____cin
	#define cout ____cout
	ifstream cin(INPUT_FILE);
	ofstream cout(OUTPUT_FILE);
#else
	#ifdef LOCAL_INPUT_FILE
		#define cin ____cin
		ifstream cin("input.txt");
	#endif
#endif

const int infinity = (int)1e9 + 42;
const int64_t llInfinity = (int64_t)1e18 + 256;
const int module = (int)1e9 + 7;
const long double eps = 1e-8;

mt19937_64 randGen(system_clock().now().time_since_epoch().count());

inline void raiseError(string errorCode) {
	cerr << "Error : " << errorCode << endl;
	exit(42);
}

signed main() {
	#ifndef USE_FILE_IO
		ios_base::sync_with_stdio(false);
	#endif
	int n, s; cin >> n >> s;
	vector<int> v(n);
	map<int, int> kompr;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		kompr[v[i]] = 42;
	}
	int k = 0;
	for (auto &it: kompr) {
		it.second = k++;
	}
	for (int i = 0; i < n; i++) {
		v[i] = kompr[v[i]];
	}
	auto w = v;
	sort(w.begin(), w.end());

	vector< vector<int> > g(k);
	map< pair<int, int>, vector<int> > indices;
	for (int i = 0; i < n; i++) {
		if (w[i] == v[i]) {
			continue;
		}
		s--;
		g[w[i]].push_back(v[i]);
		indices[{w[i], v[i]}].push_back(i);
	}
	if (s < 0) {
		cout << -1 << "\n";
		return 0;
	}

	vector<int> pass;
	function<void(int)> dfs = [&](int v) {
		while (!g[v].empty()) {
			int to = g[v].back();
			g[v].pop_back();
			dfs(to);
		}
		pass.push_back(v);
	};

	vector< vector<int> > ans;
	for (int i = 0; i < k; i++) {
		if (g[i].empty()) {
			continue;
		}
		dfs(i);
		ans.emplace_back();
		for (int j = 1; j < (int)pass.size(); j++) {
			auto &vec = indices[{pass[j], pass[j-1]}];
			assert(!vec.empty());
			ans.back().push_back(vec.back());
			vec.pop_back();
		}
		reverse(ans.back().begin(), ans.back().end());
	}

	cout << ans.size() << "\n";
	for (auto vec: ans) {
		cout << vec.size() << "\n";
		for (auto it: vec) {
			cout << it+1 << " ";
		}
		cout << "\n";
	}

	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <sstream>
#include <tuple>
#include <vector>

using namespace std;
using namespace chrono;

#ifdef DEBUG
	#define LOCAL_INPUT_FILE
#else
	//#define USE_FILE_IO
#endif

#ifdef USE_FILE_IO
	#define INPUT_FILE "input.txt"
	#define OUTPUT_FILE "output.txt"
	#define cin ____cin
	#define cout ____cout
	ifstream cin(INPUT_FILE);
	ofstream cout(OUTPUT_FILE);
#else
	#ifdef LOCAL_INPUT_FILE
		#define cin ____cin
		ifstream cin("input.txt");
	#endif
#endif

const int infinity = (int)1e9 + 42;
const int64_t llInfinity = (int64_t)1e18 + 256;
const int module = (int)1e9 + 7;
const long double eps = 1e-8;

mt19937_64 randGen(system_clock().now().time_since_epoch().count());

inline void raiseError(string errorCode) {
	cerr << "Error : " << errorCode << endl;
	exit(42);
}

inline void test(istream &cin, ostream &cout) {
	int n, s; cin >> n >> s;
	vector<int> v(n);
	map<int, int> kompr;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		kompr[v[i]] = 42;
	}
	int k = 0;
	for (auto &it: kompr) {
		it.second = k++;
	}
	for (int i = 0; i < n; i++) {
		v[i] = kompr[v[i]];
	}
	auto w = v;
	sort(w.begin(), w.end());

	vector< vector<int> > g(k);
	map< pair<int, int>, vector<int> > indices;
	for (int i = 0; i < n; i++) {
		if (w[i] == v[i]) {
			continue;
		}
		s--;
		g[w[i]].push_back(v[i]);
		indices[{w[i], v[i]}].push_back(i);
	}
	if (s < 0) {
		cout << -1 << "\n";
		return;
	}

	vector<char> used(n, false);
	function<void(int)> pdfs = [&](int v) {
		if (used[v]) {
			return;
		}
		used[v] = true;
		for (int to: g[v]) {
			pdfs(to);
		}
	};
	int comps = 0;
	for (int i = 0; i < k; i++) {
		if (!used[i]) {
			pdfs(i);
			if (!g[i].empty()) {
				comps++;
			}
		}
	}

	vector<int> pass;
	function<void(int)> dfs = [&](int v) {
		while (!g[v].empty()) {
			int to = g[v].back();
			g[v].pop_back();
			dfs(to);
		}
		pass.push_back(v);
	};

	vector< vector<int> > ans;
	for (int i = 0; i < k; i++) {
		if (g[i].empty()) {
			continue;
		}
		pass.clear();
		dfs(i);
		ans.emplace_back();
		for (int j = 1; j < (int)pass.size(); j++) {
			auto &vec = indices[{pass[j], pass[j-1]}];
			assert(!vec.empty());
			ans.back().push_back(vec.back());
			vec.pop_back();
		}
		reverse(ans.back().begin(), ans.back().end());
	}
	assert((int)ans.size() == comps);

	int canUnite = min(s, (int)ans.size());
	if (canUnite > 2) {
		vector<int> united;
		vector<int> loop2;
		for (int i = 0; i < canUnite; i++) {
			united.insert(united.end(), ans.back().begin(), ans.back().end());
			loop2.push_back(ans.back()[0]);
			ans.pop_back();
		}
		ans.push_back(united);
		reverse(loop2.begin(), loop2.end());
		ans.push_back(loop2);
	}

	cout << ans.size() << "\n";
	for (auto vec: ans) {
		cout << vec.size() << "\n";
		for (auto it: vec) {
			cout << it+1 << " ";
		}
		cout << "\n";
	}
}

signed main() {
	#ifndef USE_FILE_IO
		ios_base::sync_with_stdio(false);
	#endif
	test(cin, cout);

	/*int tid = 0;
	mt19937_64 rnd(42);
	for (;;) {
		cout << "Test " << ++tid << endl;
		ostringstream qq;
		int n = rnd() % 20 + 1;
		qq << n << " " << n << endl;
		for (int i = 0; i < n; i++) {
			qq << rnd() % 20 + 1 << " ";
		}
		qq << endl;
		istringstream is(qq.str());
		cout << "Input:" << endl << qq.str();
		cout << "Output:" << endl;
		test(is, cout);
		cout << endl;
	}*/

	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <sstream>
#include <tuple>
#include <vector>

using namespace std;
using namespace chrono;

#ifdef DEBUG
	#define LOCAL_INPUT_FILE
#else
	//#define USE_FILE_IO
#endif

#ifdef USE_FILE_IO
	#define INPUT_FILE "input.txt"
	#define OUTPUT_FILE "output.txt"
	#define cin ____cin
	#define cout ____cout
	ifstream cin(INPUT_FILE);
	ofstream cout(OUTPUT_FILE);
#else
	#ifdef LOCAL_INPUT_FILE
		#define cin ____cin
		ifstream cin("input.txt");
	#endif
#endif

const int infinity = (int)1e9 + 42;
const int64_t llInfinity = (int64_t)1e18 + 256;
const int module = (int)1e9 + 7;
const long double eps = 1e-8;

mt19937_64 randGen(system_clock().now().time_since_epoch().count());

inline void raiseError(string errorCode) {
	cerr << "Error : " << errorCode << endl;
	exit(42);
}

signed main() {
	#ifndef USE_FILE_IO
		ios_base::sync_with_stdio(false);
	#endif

	int n, s; cin >> n >> s;
	vector<int> v(n);
	map<int, int> kompr;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		kompr[v[i]] = 42;
	}
	int k = 0;
	for (auto &it: kompr) {
		it.second = k++;
	}
	for (int i = 0; i < n; i++) {
		v[i] = kompr[v[i]];
	}
	auto w = v;
	sort(w.begin(), w.end());

	vector< vector<int> > g(k);
	map< pair<int, int>, vector<int> > indices;
	for (int i = 0; i < n; i++) {
		if (w[i] == v[i]) {
			continue;
		}
		s--;
		g[w[i]].push_back(v[i]);
		indices[{w[i], v[i]}].push_back(i);
	}

	if (s < 0) {
		cout << -1 << "\n";
		return 0;
	}

	vector<int> pass;
	function<void(int)> dfs = [&](int v) {
		while (!g[v].empty()) {
			int to = g[v].back();
			g[v].pop_back();
			dfs(to);
		}
		pass.push_back(v);
	};

	vector< vector<int> > ans;
	for (int i = 0; i < k; i++) {
		if (g[i].empty()) {
			continue;
		}
		pass.clear();
		dfs(i);
		ans.emplace_back();
		for (int j = 1; j < (int)pass.size(); j++) {
			auto &vec = indices[{pass[j], pass[j-1]}];
			assert(!vec.empty());
			ans.back().push_back(vec.back());
			vec.pop_back();
		}
		reverse(ans.back().begin(), ans.back().end());
	}

	int canUnite = min(s, (int)ans.size());
	if (canUnite > 2) {
		vector<int> united;
		vector<int> loop2;
		for (int i = 0; i < canUnite; i++) {
			united.insert(united.end(), ans.back().begin(), ans.back().end());
			loop2.push_back(ans.back()[0]);
			ans.pop_back();
		}
		ans.push_back(united);
		reverse(loop2.begin(), loop2.end());
		ans.push_back(loop2);
	}

	cout << ans.size() << "\n";
	for (auto vec: ans) {
		cout << vec.size() << "\n";
		for (auto it: vec) {
			cout << it+1 << " ";
		}
		cout << "\n";
	}

	return 0;
}


#include <bits/stdc++.h>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define ar array
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(s) (int) (s).size()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define ff(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define FF(i, a, b) for (int i = (int)(a); i >= (int)(b); --i)
#define trav(a, x) for (auto& (a) : (x))

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int N = 2e5 + 5;

int n, s, cnt, to[N], a[N], b[N], pos[N];
vi all[N];

pii p[N];
void compress() {
	forn(i, n) p[i] = {a[i], i};
	sort(p, p + n);
	int num = 0;
	for (int i = 0; i < n; ) {
		int start = i;
		while (i < n && p[i].fi == p[start].fi) {
			a[p[i].se] = num;
			i++;
		}
		num++;
	}
}

vvi cycles;
vpi g[N];
int par[N];

void init() {
	for1(i, n) par[i] = i;
}

int find_set(int v) {
	if (v == par[v]) return v;
	return par[v] = find_set(par[v]);
}

void union_set(int a, int b) {
	a = find_set(a); b = find_set(b);
	par[a] = b;
}

bool used[N];
void find_all_cycles() {
	cycles.clear();
	memset(used, 0, sizeof(used));
	forn(i, n) {
		if (!used[i] && to[i] != -1) {
			int pos = i;
			vi cycle;
			while (used[pos] == 0) {
				used[pos] = 1;
				cycle.pb(pos);
				g[a[pos]].eb(sz(cycles), pos);
				pos = to[pos];
			}
			cycles.pb(cycle);
		}
	}
}

int main(int argc, char **argv) {
	ios::sync_with_stdio(0); cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
#endif

	cin >> n >> s;
	forn(i, n) cin >> a[i];
	compress();
	copy(a, a + n, b);
	sort(b, b + n);
	forn(i, n) {
		if (a[i] != b[i]) all[a[i]].pb(i);
		to[i] = -1;
	}
	forn(i, n) {
		if (a[i] != b[i]) {
			int p = all[b[i]][pos[b[i]]++];
			to[p] = i;
			cnt++;
		}
	}
	if (cnt > s) {
		cout << -1 << '\n';
		return 0;
	}
	find_all_cycles();
	init();
	forn(i, n) {
		if (sz(g[i]) > 1) {
			pii first = g[i][0];
			trav(p, g[i]) {
				if (find_set(first.fi) != find_set(p.fi)) {
					union_set(first.fi, p.fi);
					swap(to[first.se], to[p.se]);
				}
			}
		}
	}
	find_all_cycles();
	int ans = sz(cycles);
	if (s > cnt) {
		int q = min(sz(cycles), s - cnt);
		if (q >= 3) {
			ans += 2 - q;
			cout << ans << '\n';
			vi v;
			cout << q << '\n';
			forn(i, q) {
				v.pb(cycles[i][0]);
				cout << cycles[i][0] + 1 << " \n"[i == q - 1];
			}
			int cp = to[v.back()];
			FF(i, sz(v) - 1, 1) to[v[i]] = to[v[i - 1]];
			to[v[0]] = cp;
			find_all_cycles();
		} else {
			cout << ans << '\n';
		}
	} else cout << ans << '\n';
	trav(p, cycles) {
		cout << sz(p) << '\n';
		trav(i, p) cout << i + 1 << ' ';
		cout << '\n';
	}
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using ll = int64_t;
using ld = double;
using ull = uint64_t;
using namespace std;
using namespace __gnu_pbds;

const int MAXN = 200228;
int nx[MAXN];
int p_[MAXN];

int p(int x) {
    return p_[x] == x ? x : (p_[x] = p(p_[x]));
}

int a[MAXN];
int b[MAXN];
bool dead[MAXN];

int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20);
    int n, s;
    cin >> n >> s;

    map<int, vector<int>> m;

    set<int> avail;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        b[i] = a[i];
        avail.insert(i);
        m[a[i]].push_back(i);
    }

    sort(b, b + n);
    for (int i = 0; i < n; ++i) {
        if (a[i] == b[i]) {
            ++s;
            avail.erase(i);
            nx[i] = i;
            dead[i] = true;
        }
    }

    for (int i = 0; i < n; ++i) {
        p_[i] = i;
    }

    for (int i = 0; i < n; ++i) {
        if (dead[i]) continue;

        auto  it = avail.lower_bound(lower_bound(b, b + n, a[i]) - b);
        nx[i] = *it;
        int pi = p(i), pnx = p(nx[i]);
        if (pi != pnx) {
            p_[pi] = pnx;
        }

        avail.erase(it);
    }

    if (s < n) {
        cout << "-1\n";
        return 0;
    }

    for (auto&[_, v] : m) {
        vector<int> v2;
        for (int x : v) {
            if (!dead[x]) {
                v2.push_back(x);
            }
        }

        for (int i = 1; i < v2.size(); ++i) {
            int x = v2[i - 1], y = v2[i];
            int px = p(x), py = p(y);
            if (px != py) {
                swap(nx[x], nx[y]);
                p_[px] = py;
            }
        }
    }

    vector<vector<int>> ans;

    auto gen = [&]() {
        ans.clear();
        fill(dead, dead + n, false);

        for (int i = 0; i < n; ++i) {
            if (!dead[i] && nx[i] != i) {
                ans.emplace_back();
                int j = i;
                while (!dead[j]) {
                    dead[j] = true;
                    ans.back().push_back(j);
                    j = nx[j];
                }
            }
        }
    };

    gen();

    int cyc = min<int>(ans.size(), s - n);
    if (cyc > 2) {
        vector<int> ad;

        for (int j = 0; j < cyc; ++j) {
            ad.push_back(ans[cyc - 1 - j][0]);
            if (j) {
                swap(nx[ans[j][0]], nx[ans[j - 1][0]]);
            }
        }

        gen();

        ans.insert(ans.begin(), ad);
    }

    cout << ans.size() << "\n";
    for (auto& v : ans) {
        cout << v.size() << "\n";
        for (int x : v) {
            cout << x + 1 << " ";
        }

        cout << "\n";
    }
}