stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<map>

const int N=3e5+5;

using namespace std;

typedef long long ll;

typedef map<ll,ll>::iterator mit;

int n,q;

ll p[N];

map<ll,ll> mp;

ll cnt[N];

int main()

{

    scanf("%d%d",&n,&q);

    if(q==0){

        for(int i=1;i<=n;i++)

            puts("1");

        return 0;

    }

    for(int i=1;i<=q;i++)

        scanf("%lld",&p[i]);

    mp[p[q]]++;

    p[0]=n;

    for(int i=q-1;i>=0;i--){

        while(mp.rbegin()->first>p[i]){

            mit it=mp.end();

            it--;

            mp[it->first%p[i]]+=it->second;

            mp[p[i]]+=it->second*(it->first/p[i]);

            mp.erase(it);

        }

    }

    for(mit it=mp.begin();it!=mp.end();it++)

        cnt[it->first]+=it->second;

    for(int i=n;i>=1;i--)

        cnt[i]=cnt[i]+cnt[i+1];

    for(int i=1;i<=n;i++)

        printf("%lld\n",cnt[i]);

}


// Faster C++ solution for the same problem (measured speedup: 4.741451724155868x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

const int MAXN=100005;



int N,Q,tp;

long long q[MAXN],stk[MAXN];

long long sum[MAXN],cnt[MAXN];



int main()

{

    scanf("%d%d",&N,&Q);

    for(int i=1;i<=Q;i++)

        scanf("%lld",&q[i]);

    stk[tp=1]=N;

    for(int i=1;i<=Q;i++)

    {

        while(tp&&stk[tp]>=q[i])

            tp--;

        stk[++tp]=q[i];

    }



	cnt[tp]=1;

	for(int i=tp;i>0;i--)

	{

		long long k=stk[i];

		int p=i-1;

		while(p)

		{

			cnt[p]+=(k/stk[p])*cnt[i];

			k%=stk[p];

			p=lower_bound(stk+1,stk+p,k)-stk;

			p--;

		}

		sum[1]+=cnt[i];

		sum[k+1]-=cnt[i];

		//printf("Add(1,%lld)\n",k);

	}

	long long ans=0;

	for(int i=1;i<=N;i++)

	{

		ans+=sum[i];

		printf("%lld\n",ans);

	}



    fclose(stdin);

    fclose(stdout);

    return 0;

}
// Slower C++ solution:
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>

#include <sstream>

#include <iomanip>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <cctype>

#include <cstring>

#include <vector>

#include <list>

#include <queue>

#include <deque>

#include <stack>

#include <map>

#include <set>

#include <algorithm>

#include <iterator>

#include <bitset>

#include <ctime>

#include<complex>

using namespace std;



#define FOR(i,a,b) for (int i = (a); i < (b); i++)

#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)

#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)

#define FILL(a,value) memset(a, value, sizeof(a))



#define SZ(a) (int)a.size()

#define ALL(a) a.begin(), a.end()

#define PB push_back

#define MP make_pair



typedef long long LL;

typedef vector<int> VI;

typedef pair<int, int> PII;



const double PI = acos(-1.0);

const int INF = 1000 * 1000 * 1000 + 7;

const LL LINF = INF * (LL)INF;



const int MAX = 1000 * 100 + 47;

const int MOD = 1000 * 1000 * 1000 + 7;



LL T[MAX];

LL A[MAX];

LL Q[MAX];

int sz;



int main()

{

	//freopen("in.txt", "r", stdin);

	//freopen("out.txt", "w", stdout);

	ios::sync_with_stdio(false); cin.tie(0);

	int n, q;

	cin >> n >> q;

	if (q == 0)

	{

		FOR(i, 0, n) cout << "1\n";

		return 0;

	}



	FOR(i, 0, q)

	{

		LL a;

		cin >> a;

		while (sz && Q[sz - 1] >= a) sz--;

		Q[sz++] = a;

	}

	

	//cout << sz << endl;

	//FOR(i, 0, sz) cout << Q[i] << " ";

	//cout << endl;

	T[sz - 1] = 1;

	LL cnt = min(Q[0], (LL)n);



	RFOR(i, sz, 0)

	{

		LL a = Q[i];

		while (1)

		{

			int ind = lower_bound(Q, Q + sz, a) - Q;

			if (ind == 0) break;

			ind--;



			T[ind] += T[i] * (a / Q[ind]);

			a %= Q[ind];

		}



		A[cnt - 1] += (a / cnt) * T[i];

		if (a % cnt) A[a % cnt - 1] += T[i];

	}



	//FOR(i, 0, n) cout << A[i] << " ";

	//cout << endl;

	RFOR(i, n - 1, 0)

	{

		A[i] += A[i + 1];

	}



	FOR(i, 0, n) cout << A[i] << " \n";

	cout << endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.241511893058576x):
#include <cstdio>

#include <algorithm>

using namespace std;

typedef long long ll;

const int N = 100100;

ll q[N],f[N],tag[N],x;

int n,Q,tail;

void solve(ll d,ll v) {

    if(d==0) return ;

    int j=upper_bound(q+1,q+tail+1,d)-q-1;

    if(j==0) tag[1]+=v,tag[d+1ll]-=v;

    else f[j]+=d/q[j]*v,solve(d%q[j],v);

}

int main() {

    scanf("%d%d",&n,&Q);

    q[++tail]=(ll)n;

    for(int i=1;i<=Q;i++) {

        scanf("%lld",&x);

        while(tail&&q[tail]>=x) tail--;

        q[++tail]=x;

    }

    f[tail]=1;

    for(int i=tail;i>1;i--) {

        f[i-1]+=q[i]/q[i-1]*f[i];

        solve(q[i]%q[i-1],f[i]);

    }

    tag[1]+=f[1],tag[q[1]+1ll]-=f[1];

    for(int i=1;i<=n;i++) tag[i]+=tag[i-1],printf("%lld\n",tag[i]);

}
// Slower C++ solution:
#include <algorithm>

#include <iterator>

#include <iostream>

#include <cstring>

#include <cstdio>

#include <vector>

#include <stack>

#define REDIRECT(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)

#define CLOSEALL() fclose(stdin), fclose(stdout)

using namespace std;

typedef long long i64;

const int MAXN = 1e5 + 10;

const int MAXQ = 1e5 + 10;



int N, Q;



int monoTop;

i64 monoStk[MAXN], tmp[MAXN], ans[MAXN];



void solve(i64 query, i64 delta)

{

	int index = lower_bound(monoStk + 1, monoStk + monoTop + 1, query) - monoStk - 1;

	if(index <= 0)

		ans[1] += delta, ans[query + 1] -= delta;

	else

		tmp[index] += delta * (query / monoStk[index]),

		solve(query % monoStk[index], delta);

}



int main()

{

	//REDIRECT("seq");



	scanf("%d%d", &N, &Q);

	monoStk[++monoTop] = N;

	for(int i = 1; i <= Q; i++)

	{

		i64 t;

		scanf("%lld", &t);



		while(monoTop && t < monoStk[monoTop])

			monoTop--;

		monoStk[++monoTop] = t;

	}



	tmp[monoTop] = 1;

	for(int i = monoTop; i > 0; i--)

		solve(monoStk[i], tmp[i]);

	for(int i = 1; i <= N; i++)

		ans[i] += ans[i-1], printf("%lld\n", ans[i]);



	CLOSEALL();

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.160395492728146x):
#include <cstdio>

#include <algorithm>

using namespace std;

typedef long long ll;

const int N = 100100;

ll q[N],f[N],tag[N],x;

int n,Q,tail;

void solve(ll d,ll v) {

    if(d==0) return ;

    int j=upper_bound(q+1,q+tail+1,d)-q-1;

    if(j==0) tag[1]+=v,tag[d+1ll]-=v;

    else f[j]+=d/q[j]*v,solve(d%q[j],v);

}

int main() {

    scanf("%d%d",&n,&Q);

    q[++tail]=(ll)n;

    for(int i=1;i<=Q;i++) {

        scanf("%lld",&x);

        while(tail&&q[tail]>=x) tail--;

        q[++tail]=x;

    }

    f[tail]=1;

    for(int i=tail;i>1;i--) {

        f[i-1]+=q[i]/q[i-1]*f[i];

        solve(q[i]%q[i-1],f[i]);

    }

    tag[1]+=f[1],tag[q[1]+1ll]-=f[1];

    for(int i=1;i<=n;i++) tag[i]+=tag[i-1],printf("%lld\n",tag[i]);

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<map>

const int N=3e5+5;

using namespace std;

typedef long long ll;

typedef map<ll,ll>::iterator mit;

int n,q;

ll p[N];

map<ll,ll> mp;

ll cnt[N];

int main()

{

    scanf("%d%d",&n,&q);

    if(q==0){

        for(int i=1;i<=n;i++)

            puts("1");

        return 0;

    }

    for(int i=1;i<=q;i++)

        scanf("%lld",&p[i]);

    mp[p[q]]++;

    p[0]=n;

    for(int i=q-1;i>=0;i--){

        while(mp.rbegin()->first>p[i]){

            mit it=mp.end();

            it--;

            mp[it->first%p[i]]+=it->second;

            mp[p[i]]+=it->second*(it->first/p[i]);

            mp.erase(it);

        }

    }

    for(mit it=mp.begin();it!=mp.end();it++)

        cnt[it->first]+=it->second;

    for(int i=n;i>=1;i--)

        cnt[i]=cnt[i]+cnt[i+1];

    for(int i=1;i<=n;i++)

        printf("%lld\n",cnt[i]);

}


// Faster C++ solution for the same problem (measured speedup: 4.803167707001788x):
#include <cstdio>

#include <algorithm>

using namespace std;

typedef long long ll;

const int N = 100100;

ll q[N],f[N],tag[N],x;

int n,Q,tail;

void solve(ll d,ll v) {

    if(d==0) return ;

    int j=upper_bound(q+1,q+tail+1,d)-q-1;

    if(j==0) tag[1]+=v,tag[d+1ll]-=v;

    else f[j]+=d/q[j]*v,solve(d%q[j],v);

}

int main() {

    scanf("%d%d",&n,&Q);

    q[++tail]=(ll)n;

    for(int i=1;i<=Q;i++) {

        scanf("%lld",&x);

        while(tail&&q[tail]>=x) tail--;

        q[++tail]=x;

    }

    f[tail]=1;

    for(int i=tail;i>1;i--) {

        f[i-1]+=q[i]/q[i-1]*f[i];

        solve(q[i]%q[i-1],f[i]);

    }

    tag[1]+=f[1],tag[q[1]+1ll]-=f[1];

    for(int i=1;i<=n;i++) tag[i]+=tag[i-1],printf("%lld\n",tag[i]);

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

const int N = 100010;

LL n, q, x, w[N], p[N];

stack<LL> s;

vector<LL> v;

void solve(LL pos, LL W) {

    int x = lower_bound(v.begin(), v.end(), pos) - v.begin() - 1;

    if (x<0) {

        p[1] += W;

        p[pos+1] -= W;

        return;

    }

    w[x] += pos / v[x] * W;

    solve(pos % v[x], W);

}

int main() {

    scanf("%lld%lld", &n, &q);

    s.push(n);

    for (int i = 1; i <= q; i++) {

        scanf("%lld", &x);

        while (s.size() && s.top() >= x) s.pop();

        s.push(x);

    }

    while (s.size()) {

        v.push_back(s.top());

        s.pop();

    }

    reverse(v.begin(), v.end());

    w[v.size() - 1] = 1;

    for (int i = v.size() - 1; ~i; i--) solve(v[i], w[i]);

    for (int i = 1; i <= n; i++) p[i] += p[i - 1];

    for (int i = 1; i <= n; i++) printf("%lld\n", p[i]);

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.158391580176761x):
#include <cstdio>

#include <algorithm>

using namespace std;

typedef long long ll;

const int N = 100100;

ll q[N],f[N],tag[N],x;

int n,Q,tail;

void solve(ll d,ll v) {

    if(d==0) return ;

    int j=upper_bound(q+1,q+tail+1,d)-q-1;

    if(j==0) tag[1]+=v,tag[d+1ll]-=v;

    else f[j]+=d/q[j]*v,solve(d%q[j],v);

}

int main() {

    scanf("%d%d",&n,&Q);

    q[++tail]=(ll)n;

    for(int i=1;i<=Q;i++) {

        scanf("%lld",&x);

        while(tail&&q[tail]>=x) tail--;

        q[++tail]=x;

    }

    f[tail]=1;

    for(int i=tail;i>1;i--) {

        f[i-1]+=q[i]/q[i-1]*f[i];

        solve(q[i]%q[i-1],f[i]);

    }

    tag[1]+=f[1],tag[q[1]+1ll]-=f[1];

    for(int i=1;i<=n;i++) tag[i]+=tag[i-1],printf("%lld\n",tag[i]);

}
// Slower C++ solution:
#include <cstdio>

#include <iostream>

#include <algorithm>

#include <cstring>

#include <cmath>

#define ll long long

using namespace std; 

const int N=200010;

ll n,num,m,x; 

ll a[N],f[N],s[N]; 

void solve(ll x,ll k){

	if (x<a[1]){

		s[x]+=k;

		return;

	}

	ll l=1,r=num,y;

	while (l<=r){

		ll mid=(l+r)/2;

		if (a[mid]<=x){

			y=mid;

			l=mid+1;

		}else r=mid-1;

	}

	f[y]+=k*(x/a[y]);

	x=x%a[y];

	if (x) solve(x,k);

}

int main(){

	scanf("%lld%lld",&n,&m);

	num=1;

	a[1]=n;

	for (ll i=1; i<=m; i++){

		scanf("%lld",&x);

		while (x<=a[num]&&num)

			--num;

		num++;

		a[num]=x;

	}

	f[num]=1;

	for (ll i=num-1; i>=1; i--){

		f[i]+=f[i+1]*(a[i+1]/a[i]);

		solve(a[i+1]%a[i],f[i+1]);

	}

	for (ll i=a[1]; i>=1; i--)

		s[i]+=s[i+1];

	for (ll i=1; i<=a[1]; i++)

		s[i]+=f[1];

	for (ll i=1; i<=n; i++)

		printf("%lld\n",s[i]);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.107037252419012x):
#include <cstdio>

#include <algorithm>

using namespace std;

typedef long long ll;

const int N = 100100;

ll q[N],f[N],tag[N],x;

int n,Q,tail;

void solve(ll d,ll v) {

    if(d==0) return ;

    int j=upper_bound(q+1,q+tail+1,d)-q-1;

    if(j==0) tag[1]+=v,tag[d+1ll]-=v;

    else f[j]+=d/q[j]*v,solve(d%q[j],v);

}

int main() {

    scanf("%d%d",&n,&Q);

    q[++tail]=(ll)n;

    for(int i=1;i<=Q;i++) {

        scanf("%lld",&x);

        while(tail&&q[tail]>=x) tail--;

        q[++tail]=x;

    }

    f[tail]=1;

    for(int i=tail;i>1;i--) {

        f[i-1]+=q[i]/q[i-1]*f[i];

        solve(q[i]%q[i-1],f[i]);

    }

    tag[1]+=f[1],tag[q[1]+1ll]-=f[1];

    for(int i=1;i<=n;i++) tag[i]+=tag[i-1],printf("%lld\n",tag[i]);

}
// Slower C++ solution:
#include<cstdio>

#include<algorithm>

#include<map>

using namespace std;



typedef long long ll;

const int MAXN=1e5+5;



int n,m;

ll ans[MAXN],q[MAXN];

map<ll,ll> a;

map<ll,ll>::iterator it;



int main(){



    scanf("%d%d",&n,&m);

    if(m==0){

        for(int i=1;i<=n;i++) puts("1");

        return 0;

    }

    for(int i=1;i<=m;i++) scanf("%lld",&q[i]);

    a[q[m]]++; q[0]=n;

    for(int i=m-1;i>=0;i--)

        while(a.rbegin()->first>q[i]){

            it=a.end(); it--;

            a[it->first%q[i]]+=it->second;

            a[q[i]]+=it->second*(it->first/q[i]);

            a.erase(it);

        }

    for(it=a.begin();it!=a.end();it++) ans[it->first]+=it->second;

    for(int i=n;i>=1;i--) ans[i]+=ans[i+1];

    for(int i=1;i<=n;i++)

        printf("%lld\n",ans[i]);



    fclose(stdin);

    fclose(stdout);

}


// Faster C++ solution for the same problem (measured speedup: 4.811451284682335x):
#include<cstdio>

#define LL long long

#define maxn 100005

int n,q,r;

LL a[maxn],cnt[maxn],app[maxn],ans[maxn];

int BS(int l,int r,LL k)

{

	while(l+1<r)

	{

		int mid=(l+r)>>1;

		if(a[mid]<=k) l=mid;

		else r=mid;

	}

	return r;

}

int main()

{

	scanf("%d%d",&n,&r);

	a[q=1]=n;

	for(int i=1;i<=r;i++)

	{

		LL x;

		scanf("%lld",&x);

		while(q&&a[q]>=x) q--;

		a[++q]=x;

	}

	app[q]=1;

	for(int i=q;i;i--)

	{

		LL l=a[i];

		int p=BS(1,i-1,l);

		while(p)

		{

			app[p]+=l/a[p]*app[i];

			l%=a[p];

			p=BS(1,p-1,l);

		}

		ans[l]+=app[i];

	}

	for(int i=n;i;i--) ans[i]+=ans[i+1];

	for(int i=1;i<=n;i++) printf("%lld\n",ans[i]);

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<map>

#define SF scanf

#define PF printf

#define MAXN 300010

#define INF 0x3FFFFFFF

#define MOD 998244353

using namespace std;

typedef long long ll;

typedef map<ll,ll>::iterator mit;

int n,q;

ll qx[MAXN];

map<ll,ll> mp;

ll used[MAXN];

int main(){

	SF("%d%d",&n,&q);

	for(int i=1;i<=q;i++)

		SF("%lld",&qx[i]);

	qx[0]=n;

	mp[qx[q]]++;

	for(int i=q-1;i>=0;i--){

		while(mp.rbegin()->first>qx[i]){

			mit it=mp.end();

			it--;	

			mp[it->first%qx[i]]+=it->second;

			mp[qx[i]]+=it->second*(it->first/qx[i]);

			mp.erase(it);

		}

	}

	mit it=mp.begin();

	for(;it!=mp.end();it++)

		used[it->first]+=it->second;

	for(int i=n;i>=1;i--)

		used[i]=used[i]+used[i+1];

	for(int i=1;i<=n;i++)

		PF("%lld\n",used[i]);

}

// Faster C++ solution for the same problem (measured speedup: 4.804648588688328x):
#include<cstdio>

#include<algorithm>

using namespace std;

#define MAXN 100010

#define LL long long

int n,Q,r;

LL q[MAXN],st[MAXN],a[MAXN],c[MAXN];

void Solve(LL x,LL y)

{

	int p=upper_bound(st,st+1+r,x)-st-1;

	if(!p) a[1]+=y,a[x+1]-=y;

	else c[p]+=y*(x/st[p]),Solve(x%st[p],y);

}

int main()

{

	scanf("%d%d",&n,&Q);

	if(Q==0)

	{

		for(int i=1;i<=n;i++)

			printf("1\n");

		return 0;

	}

	for(int i=1;i<=Q;i++)

		scanf("%lld",&q[i]);

	st[++r]=q[Q];

	q[0]=n;

	for(int i=Q-1;i>=0;i--)

		if(st[r]>q[i])

			st[++r]=q[i];

	for(int i=1;i<r-i+1;i++)

		swap(st[i],st[r-i+1]);

	c[r]=1;

	for(int i=r;i>1;i--)

	{

		c[i-1]+=c[i]*(st[i]/st[i-1]);

		Solve(st[i]%st[i-1],c[i]);

	}

	for(int i=1;i<=n;i++)

		a[i]+=a[i-1];

	for(int i=1;i<=st[1];i++)

		a[i]+=c[1];

	for(int i=1;i<=n;i++)

		printf("%lld\n",a[i]);

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<map>

#define SF scanf

#define PF printf

#define MAXN 300010

#define INF 0x3FFFFFFF

#define MOD 998244353

using namespace std;

typedef long long ll;

typedef map<ll,ll>::iterator mit;

int n,q;

ll qx[MAXN];

map<ll,ll> mp;

ll used[MAXN];

int main(){

	SF("%d%d",&n,&q);

	for(int i=1;i<=q;i++)

		SF("%lld",&qx[i]);

	qx[0]=n;

	mp[qx[q]]++;

	for(int i=q-1;i>=0;i--){

		while(mp.rbegin()->first>qx[i]){

			mit it=mp.end();

			it--;	

			mp[it->first%qx[i]]+=it->second;

			mp[qx[i]]+=it->second*(it->first/qx[i]);

			mp.erase(it);

		}

	}

	mit it=mp.begin();

	for(;it!=mp.end();it++)

		used[it->first]+=it->second;

	for(int i=n;i>=1;i--)

		used[i]=used[i]+used[i+1];

	for(int i=1;i<=n;i++)

		PF("%lld\n",used[i]);

}

// Faster C++ solution for the same problem (measured speedup: 4.802053670122908x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 100000

using namespace std;

typedef long long LL;

int N,Q,t;

LL stk[MAXN+5],q[MAXN+5];

LL xs[MAXN+5],res[MAXN+5],ans[MAXN+5];

void DFS(LL len,LL pre)

{

	int p=upper_bound(stk,stk+1+t,len)-stk-1;

	if(p==0)

	{

		res[1]+=pre;

		res[len+1]-=pre;

		return;

	}

	xs[p]+=pre*(len/stk[p]);

	len%=stk[p];

	DFS(len,pre);

}

int main()

{

//	freopen("seq.in","r",stdin);

//	freopen("seq.out","w",stdout);

	scanf("%d %d",&N,&Q);

	if(Q==0)

	{

		for(int i=1;i<=N;i++)

			printf("1\n");

		return 0;

	}

	for(int i=1;i<=Q;i++)

		scanf("%lld",&q[i]);

	stk[++t]=q[Q];

	q[0]=N;

	for(int i=Q-1;i>=0;i--)

		if(stk[t]>q[i])

			stk[++t]=q[i];

	for(int i=1;i<=t/2;i++)

		swap(stk[i],stk[t-i+1]);

	xs[t]=1LL;

	for(int i=t-1;i>=1;i--)

	{

		xs[i]+=xs[i+1]*(stk[i+1]/stk[i]);

		DFS(stk[i+1]%stk[i],xs[i+1]);

	}

	for(int i=1;i<=N;i++)

		res[i]+=res[i-1];

	for(int i=1;i<=N;i++)

		if(i<=stk[1])

			ans[i]=xs[1]+res[i];

		else

			ans[i]=res[i];

	for(int i=1;i<=N;i++)

		printf("%lld\n",ans[i]);

	return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<map>

#define SF scanf

#define PF printf

#define MAXN 300010

#define INF 0x3FFFFFFF

#define MOD 998244353

using namespace std;

typedef long long ll;

typedef map<ll,ll>::iterator mit;

int n,q;

ll qx[MAXN];

map<ll,ll> mp;

ll used[MAXN];

int main(){

	SF("%d%d",&n,&q);

	for(int i=1;i<=q;i++)

		SF("%lld",&qx[i]);

	qx[0]=n;

	mp[qx[q]]++;

	for(int i=q-1;i>=0;i--){

		while(mp.rbegin()->first>qx[i]){

			mit it=mp.end();

			it--;	

			mp[it->first%qx[i]]+=it->second;

			mp[qx[i]]+=it->second*(it->first/qx[i]);

			mp.erase(it);

		}

	}

	mit it=mp.begin();

	for(;it!=mp.end();it++)

		used[it->first]+=it->second;

	for(int i=n;i>=1;i--)

		used[i]=used[i]+used[i+1];

	for(int i=1;i<=n;i++)

		PF("%lld\n",used[i]);

}

// Faster C++ solution for the same problem (measured speedup: 4.808784767300051x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

const long long MAXN=1000005;

long long n,q;

long long a[MAXN],s[MAXN],c[MAXN],ans[MAXN],tot;

int main()

{

	//freopen("seq.in","r",stdin);

	//freopen("seq.out","w",stdout);

	scanf("%lld %lld",&n,&q);

	a[tot=1]=n;

	for(long long i=1;i<=q;i++)

	{

		long long x;

		scanf("%lld",&x);

		while(tot&&a[tot]>=x)

			tot--;

		a[++tot]=x;

	}

	q=tot;

	s[q]=1;

	for(long long i=q;i>=1;i--)

	{

		long long l=a[i];

		long long p=i-1;

		while(p)

		{

			s[p]+=(l/a[p])*s[i];

			l%=a[p];

			p=lower_bound(a+1,a+p,l)-a-1;

		}

		ans[l]+=s[i];

	}

	for(long long i=n;i>=1;i--)

		ans[i]+=ans[i+1];

	for(long long i=1;i<=n;i++)

		printf("%lld\n",ans[i]);

}
// Slower C++ solution:
#include <bits/stdc++.h>

#define ll long long

#define res register ll

using namespace std;

ll n,num,m;

ll len[101010];

ll f[101010],sum[101010];

inline ll read()

{

  ll X=0,w=0;

  char ch=0;

  while(!isdigit(ch))

  {

    w|=ch=='-';

    ch=getchar();

  }

  while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();

  return w?-X:X;

}

void work(ll x,ll base)

{

  if (x<len[1])

  {

    sum[x]+=base;

    return;

  }

  ll l=1,r=n;

  ll total;

  while (l<=r)

  {

    ll mid=(l+r)/2;

    if (len[mid]<=x)

    {

      total=mid;

      l=mid+1;

    }

    else r=mid-1;

  }

  f[total]+=base*(x/len[total]);

  x=x%len[total];

  if (x) work(x,base);

}

int main()

{

  n=read(),m=read();

  num=1;

  len[1]=n;

  ll x;

  for (res i=1; i<=m; ++i)

  {

    x=read();

    while (x<=len[num] && num)

      --num;

    ++num;

    len[num]=x;

  }

  m=n;

  n=num;

  f[n]=1;

  for (res i=n-1; i>=1; --i)

  {

    f[i]+=f[i+1]*(len[i+1]/len[i]);

    work(len[i+1]%len[i],f[i+1]);

  }

  for (res i=len[1]; i>=1; --i)

    sum[i]+=sum[i+1];

  for (res i=1; i<=len[1]; ++i)

    sum[i]+=f[1];

  for (res i=1; i<=m; ++i)

    printf("%lld\n",sum[i]);

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.165137065735641x):
#include <cstdio>

#include <algorithm>

#include <cstring>

#include <cctype>

using namespace std;

typedef long long int64;

inline int64 read(int f = 1, int64 x = 0, char ch = ' ')

{

    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;

    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();

    return f*x;

}

const int N = 1e5+5;

int n, q, top;

int64 d[N], s[N], f[N];

void solve(int64 p, int64 q)

{

    if(!p) return;

    int r = upper_bound(s+1, s+1+top, p)-s-1;

    if(!r) d[1] += q, d[p+1] -= q;

    else f[r] += p/s[r]*q, solve(p%s[r], q);

}

int main()

{

    s[++top] = n = read(), q = read(); 

    while(q--)

    {

        int64 m = read();

        while(top&&s[top] >= m) --top;

        s[++top] = m;

    }

    f[top] = 1; 

    for(int i = top; i >= 2; --i) 

        f[i-1] += s[i]/s[i-1]*f[i], solve(s[i]%s[i-1], f[i]);

    d[1] += f[1], d[s[1]+1] -= f[1];

    for(int i = 1; i <= n; ++i) printf("%lld\n", d[i] += d[i-1]);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long

using namespace std;

ll n,m,sum[200001],f[200001],cnt,q[200001];

void solve(ll x,ll y){

	if(!x)return;

	ll now=upper_bound(q+1,q+cnt+1,x)-q-1;

	if(!now)sum[1]+=y,sum[x+1]-=y;

	 else{

	 	f[now]+=x/q[now]*y;

	 	solve(x%q[now],y);

	 }

}

int main(){

	ll i,t;

	scanf("%lld%lld",&n,&m);

	cnt=1;q[1]=n;

	for(i=1;i<=m;i++){

		scanf("%lld",&t);

		while(cnt&&t<=q[cnt])cnt--;

		q[++cnt]=t;

	}

	f[cnt]=1;

	for(i=cnt;i>1;i--)f[i-1]+=q[i]/q[i-1]*f[i],solve(q[i]%q[i-1],f[i]);

	sum[1]+=f[1];sum[q[1]+1]-=f[1];

	for(i=1;i<=n;i++)printf("%lld\n",sum[i]+=sum[i-1]);

}

// Faster C++ solution for the same problem (measured speedup: 5.181606190067885x):
#include <cstdio>

#include <algorithm>

#include <cstring>

#include <cctype>

using namespace std;

typedef long long int64;

inline int64 read(int f = 1, int64 x = 0, char ch = ' ')

{

    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;

    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();

    return f*x;

}

const int N = 1e5+5;

int n, q, top;

int64 d[N], s[N], f[N];

void solve(int64 p, int64 q)

{

    if(!p) return;

    int r = upper_bound(s+1, s+1+top, p)-s-1;

    if(!r) d[1] += q, d[p+1] -= q;

    else f[r] += p/s[r]*q, solve(p%s[r], q);

}

int main()

{

    s[++top] = n = read(), q = read(); 

    while(q--)

    {

        int64 m = read();

        while(top&&s[top] >= m) --top;

        s[++top] = m;

    }

    f[top] = 1; 

    for(int i = top; i >= 2; --i) 

        f[i-1] += s[i]/s[i-1]*f[i], solve(s[i]%s[i-1], f[i]);

    d[1] += f[1], d[s[1]+1] -= f[1];

    for(int i = 1; i <= n; ++i) printf("%lld\n", d[i] += d[i-1]);

    return 0;

}