"""
Mo ?
っぽいので書いてみよう

"""
def Sieve(n): #n以下の素数全列挙(O(nloglogn)) retは素数が入ってる。divlisはその数字の素因数が一つ入ってる

    ret = []
    divlis = [-1] * (n+1) #何で割ったかのリスト(初期値は-1)
    
    flag = [True] * (n+1)
    flag[0] = False
    flag[1] = False

    ind = 2
    while ind <= n:

        if flag[ind]:
            ret.append(ind)

            ind2 = ind ** 2

            while ind2 <= n:
                flag[ind2] = False
                divlis[ind2] = ind
                ind2 += ind

        ind += 1

    return ret,divlis

def rd(n,divlis):

    dic = {}
    cms = []
    ret = [1]

    while divlis[n] != -1:

        if divlis[n] not in dic:
            dic[divlis[n]] = 1
            cms.append(divlis[n])
        else:
            dic[divlis[n]] += 1
        n //= divlis[n]

    if n > 1 and n not in dic:
        dic[n] = 1
        cms.append(n)
    elif n > 1:
        dic[n] += 1

    for i in cms:
        nloop = len(ret)
        
        for j in range(dic[i]):
            j += 1
            
            for k in range(nloop):
                ret.append(ret[k] * (i**j))

    return ret
            
    

N,M = map(int,input().split())

retlis,divlis = Sieve(M+1)

#print (retdiver(24,divlis))



blr = []

rootN = int(N**0.5)
for i in range(N):

    l,r = map(int,input().split())
    blr.append([l // rootN,l,r])

blr.sort()

dic = {}
l = 0
r = 0

ans = [0] * (M+1)
ans[1] = 1

for lp in range(N):

    ql = blr[lp][1]
    qr = blr[lp][2]

    while r < qr:

        nlis = rd(r+1,divlis)
        for i in nlis:
            if i not in dic:
                dic[i] = 1
            else:
                dic[i] += 1
        r += 1

    while l > ql:

        nlis = rd(l-1,divlis)
        for i in nlis:
            if i not in dic:
                dic[i] = 1
            else:
                dic[i] += 1
        l -= 1   

    while r > qr:

        nlis = rd(r,divlis)
        for i in nlis:
            if i not in dic:
                dic[i] = -1
            else:
                dic[i] -= 1
        r -= 1

    while l < ql:

        nlis = rd(l,divlis)
        for i in nlis:
            if i not in dic:
                dic[i] = -1
            else:
                dic[i] -= 1
        l += 1

    dlis = []
    for i in dic:
        if dic[i] > 0:
            ans[i] += 1
        else:
            dlis.append(i)

    for i in dlis:
        del dic[i]


    #print (l,r,ql,qr)
    #print (dic,nlis)

    
for i in range(M):
    i += 1
    print (ans[i])
