#include #include using namespace std; int N,M; long now,T,np,P; main() { cin>>N>>M; for(;M--;) { cin>>T>>P; if(T-now