#include <bits/stdc++.h>
using namespace std;
#define N 200005
typedef long long ll;
typedef pair<ll,int> pii;
int n,m,sum;
struct work{
int s,t,id;
}a[N];
priority_queue <pii,vector<pii>,greater<pii> > q2;
priority_queue <int,vector<int>,greater<int> > q1,ans[N];
bool cmp(work a,work b){
return a.t<b.t;
}
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>a[i].s>>a[i].t;
a[i].id=i;
}
sort(a+1,a+n+1,cmp);
ll now=0;
for(int i=1;i<=m;i++) q1.push(i);
for(int i=1;i<=n;i++){
now=a[i].t;
while(!q2.empty()){
if(q2.top().first<=now) q1.push(q2.top().second),q2.pop();
else break;
}
ll curt=a[i].s+a[i].t; int curi=q1.top(); q1.pop();
q2.push({curt,curi});
ans[curi].push(a[i].id);
}
for(int i=1;i<=m;i++){
cout<<ans[i].size()<<' ';
while(!ans[i].empty()){
cout<<ans[i].top()<<' ';
ans[i].pop();
} cout<<endl;
}
return 0;
}
record