n,m=map(int,input().split()) lt,lp=0,0 for i in range(m): t,p=map(int,input().split()) if abs(t-lt)