include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+10,mod=1e9+7;
define PII pair<ll,ll>
define x first
define y second
define PB push_back
// void solve()
// {
// int n,m;cin>>n>>m;
// }
PII a[N];
bool cmp(PII a,PII b)
{
return a.x>b.x;
}
bool vis[N];
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n,m;cin>>n>>m;
ll sum=0;
ll t=0;
for(int i=1;i<=n;i++){
cin>>a[i].x;t=max(t,a[i].x);a[i].y=i;sum+=a[i].x;
}
if(m==1){
int last=0;
for(int i=1;i<=n;i++){
cout<<1<<" "<<1<<" ";
cout<<last<<" "<<last+a[i].x<<endl;
last+=a[i].x;
}
return 0;
}
ll tt=sum/m;
if(sum%m){
tt++;
}
t=max(t,tt);ll last=t;int p=1; for(int i=1;i<=n;i++){ ll now=a[i].x; if(now<=last){ cout<<1<<" "<<p<<" "<<t-last<<" "<<t-last+a[i].x<<endl; last-=now; if(last==0){ last=t;p++; } } else{ now-=last; cout<<2<<" "<<p+1<<" "<<0<<" "<<now<<" "; cout<<p<<" "<<t-last<<" "<<t<<endl; p++; last=t-now; } }
}