bug
#include<bits/stdc++.h>
#define FOR(i,f_start,f_end) for(int i=f_start;i<=f_end;i++)
#define MS(arr,arr_value) memset(arr,arr_value,sizeof(arr))
#define F first
#define S second
#define pii pair<int ,int >
#define mkp make_pair
#define pb push_back
using namespace std;
const int maxn=5000+5;
struct cmp{
bool operator()(const pii p1,const pii p2){
return p1.F>p2.F;
}
};
priority_queue<pii,vector<pii> ,cmp>q;
queue<pii>s;
int a[maxn];
int main(){
int n,k;
scanf("%d%d",&n,&k);
FOR(i,1,n)scanf("%d",&a[i]);
int now=0;
int ok=0;
int p=1;
int ans=0;
int que[1005];
int last=0;
for(;;){
if(q.empty()&&p>n)break;
while(q.size()<k&&p<=n){
q.push(mkp(now+a[p],p));
p++;
}
pii v=q.top();
s.push(v);
q.pop();
int tmp=0;
ok++;
tmp++;
while(!q.empty()&&q.top().F==v.F){
s.push(q.top());
q.pop();
ok++;
tmp++;
}
int d1=(100.0*ok/n+0.5);
while(!s.empty()){
pii u=s.front();
s.pop();
cout<<a[u.S]<<" "<<d1<<" "<<last<<endl;
if(a[u.S]>=last&&last!=0)ans++;
}
last=d1;
now=v.F;
}
cout<<ans<<endl;
return 0;
}