import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

void main() {
    const int TABLE_SIZE = 30001;
    SList!int[TABLE_SIZE] divisor_table;
    foreach(ref i; divisor_table) 
    {
        i = SList!int(1);
    }
    for (int div = 2; div <= sqrt(cast(double)TABLE_SIZE); div++)
    {
        for (int index = div; index < TABLE_SIZE; index+=div) {
            divisor_table[index].insert(div);
        }
    }

    auto firstline = readln.chomp.split.map!(to!int);
    immutable int M = firstline[1];
    int[] ans;
    ans.length = M;
    ans[] = 0;

    string line;
    while ((line = readln.chomp).length != 0)
    {
        auto chunks = line.split.map!(to!int);
        immutable int l = chunks[0];
        immutable int r = chunks[1];
        auto targets = new RedBlackTree!int;
        for (int i = l; i <= r; i++)
        {
            divisor_table[i].each!(d => targets.insert(d));
        }
        targets.each!(t => ans[t-1]++);
    }

    ans.each!writeln;
}
