#include
using namespace std;
mapp;
struct st
{
int num;
int period;
bool operator <(const st other) const
{
if(period!=other.period)
return period>other.period;
else
return num>other.num;
}
};
priority_queuev;
int main()
{
int n,k;
cin>>n>>k;
for(int i=0; i>s>>num>>period;
st a;
a.num=num;
a.period=period;
v.push(a);
p[num]=period;
}
for(int i=0; i