#include<bits/stdc++.h>
#define maxn 1000005
using namespace std;
typedef long long LL;
LL read()
{
    char c=getchar();LL f=1,sum=0;
    while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0' && c<='9'){sum=sum*10+c-'0';c=getchar();}
    return sum*f;
}
int n,m,top;
LL a[maxn],s[maxn];
LL ans[maxn],val[maxn];
int main()
{
	n=read();m=read();
	for(int i=1;i<=m;i++) a[i]=read();
	a[m=0]=n;
	for(int i=0;a[i];i++)
	{
		while(m && a[i]<=a[m-1]) m--;
		a[m++]=a[i];
	}
	val[m-1]=1;
	for(int i=m-1;i>=0;i--)
	{
		LL x=a[i];
		while(1)
		{
			LL pos=upper_bound(a,a+i,x)-a-1;
			if(pos<0) break;
			val[pos]+=val[i]*(x/a[pos]);
			x%=a[pos];
		}
		if(x) ans[x]+=val[i];
	}
	for(int i=n;i;i--) ans[i]+=ans[i+1];
	for(int i=1;i<=n;i++) printf("%lld\n",ans[i]);
	return 0;
}
