CodeForces1088B,code:
Your code here...
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
priority_queue<int,vector<int> ,greater<int> > q;
int main(){
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++){
int x;
cin>>x;
q.push(x);
}
int sum=0;
for(int i=1;i<=m;i++){
if(q.empty()){
cout<<0<<endl;
}
if(q.top()-sum<0){
cout<<0;
goto c;
}
cout<<q.top()-sum<<endl;
sum+=q.top();
c:while(!q.empty()&&q.top()==sum)
q.pop();
}
return 0;
}