n,m=map(int,input().split()) imos = [0]*100005 for _ in range(m): l,r=map(int,input().split()) imos[l] += 1 imos[r+1] -= 1 cum=0 for i in range(1,n+1): cum+=imos[i] print(cum)