//=================================
// Created on: 2018/09/20 14:24:35
//=================================
#include <bits/stdc++.h>
#define show(x) std::cerr << #x << " = " << x << std::endl
using ll = long long;
using ull = unsigned long long;
int main()
{
    int N, M;
    std::cin >> N >> M;
    std::map<ll, std::map<ll, ll>> as;
    ll A = 0;
    for (int i = 0; i < M; i++) {
        ll a, b;
        std::cin >> a >> b;
        if (b - a - 1 < N) {
            as[b][b - a - 1]++;
        }
        A += a;
    }
    std::vector<ll> imos(N, M);
    imos[0] += A;
    for (const auto& p : as) {
        const ll B = p.first;
        for (const auto& A : p.second) {
            for (ll base = A.first; base < N; base += B) { imos[base] -= A.second * B; }
        }
    }
    for (int i = 1; i < N; i++) { imos[i] += imos[i - 1]; }
    for (int i = 0; i < N; i++) { std::cout << imos[i] << std::endl; }
    return 0;
}

