N,M=map(int,input().split()) s="No" t0,p0=0,0 for _ in range(M): t,p=map(int,input().split()) if t-t0