#include<bits/stdc++.h>
#define ll long long
#define maxn 100005
#define inf 2e18
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=a;i>=b;i--)
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll n,q,b[maxn],cnt,c[maxn],X[maxn],ans;

inline void wk(ll x,ll y,ll z)
{
	//cout<<x<<" "<<y<<" "<<z<<endl;
	if(y<=1)
	{
		c[1]+=z; c[x+1]-=z;
		return;
	}
	ll p1=x%b[y-1],p2=x/b[y-1]; X[y-1]+=(p2*z);
	ll tmp=upper_bound(b+1,b+cnt+1,p1)-b;
	wk(p1,tmp,z);
}

int main()
{
	n=read(); q=read(); b[++cnt]=n; b[0]=-inf;
	rep(i,1,q)
	{
		ll x=read();
		while(x<=b[cnt]&&cnt!=0) cnt--; b[++cnt]=x;
	}
	X[cnt]=1;
	per(i,cnt,1) wk(b[i],i,X[i]);
	rep(i,1,n) ans+=c[i],printf("%lld\n",ans);
	return 0;
}