#D
n,k = list(map(int, input().split()))
numlist=[]
for i in range(k):
    l,r=list(map(int, input().split()))
    for j in range(l,r+1):
        numlist.append(j)
numlist.sort()
nlen=len(numlist)
count=[0]*n
count[0]=1
for i in range(n-1):
    for j in range(nlen):
        num=numlist[j]
        print(i+2,num)
        if i+2>num:
            print("go")
            count[i+1]+=count[i+1-num]
    print(count)
print(count[i+1])