#include using namespace std; template bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; } template bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; } #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long typedef pair P; //const int MAX=10100; const ll INF=1LL<<60; int main(){ int n,m; cin>>n>>m; vectort(n),p(n); rep(i,m)cin>>t[i]>>p[i]; rep(i,m){ if(t[i]