import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()


def main():
    n,m = LI()
    d = [LI() for _ in range(n)]
    a = [1] * (10001)
    t = [set([1]),set([1])]
    for i in range(2,10001):
        if a[i] == 1:
            t.append(set([1,i]))
        else:
            ti = t[a[i]]
            c = i//a[i]
            ti = ti | set(c*_ for _ in ti)
            t.append(ti)
        ai = i*2
        while ai <= 10000:
            a[ai] = i
            ai += i

    e = [0] * 10001
    for l,r in d:
        if l*2 < r:
            for i in range(1,r+1):
                e[i] += 1
            continue
        s = t[r]
        for i in range(l,r):
            s = s | t[i]
        for c in s:
            e[c] += 1
    for i in range(1,m+1):
        print(e[i])


main()
