require "prime"
N, M = gets.split.map(&:to_i)

d = []
a = Array.new(M+1,0)

def f(n)
  return [1] if n == 1
  n.prime_division.map do |m,p|
    (0..p).map do |pp|
      m ** pp
    end
  end.inject do |res, m|
    res.flat_map do |i|
      m.map do |j|
        i * j
      end
    end
  end
end

N.times do
  l,r = gets.split.map(&:to_i)
  (l..r).each do |i|
    d[i] ||= f(i)
  end
  d[l..r].flatten.uniq.each do |i|
    a[i] += 1
  end
end

puts a.drop(1)
