#include <cstdio>

#define rep( i, a, b ) for( int (i) = (a) ; (i) <= (b) ; ++ (i) )
#define per( i, a, b ) for( int (i) = (a) ; (i) >= (b) ; -- (i) )

const int mod = 1e9 + 7;
const int MAXN = 2e3 + 5;

template<typename _T>
void read( _T &x )
{
	x = 0; char s = getchar(); int f = 1;
	while( s < '0' || '9' < s ) { f = 1; if( s == '-' ) f = -1; s = getchar(); }
	while( '0' <= s && s <= '9' ) { x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ); s = getchar(); }
	x *= f;
}

template<typename _T>
void write( _T x )
{
	if( x < 0 ) putchar( '-' ), x = -x;
	if( 9 < x ) write( x / 10 );
	putchar( x % 10 + '0' );
}

int A[MAXN];
int N, M;

int Mul( long long x, int v ) { return x * v % mod; }

int Qkpow( int base, int indx )
{
	int ret = 1;
	while( indx )
	{
		if( indx & 1 ) ret = Mul( ret, base );
		base = Mul( base, base ), indx >>= 1;
	}
	return ret;
}

int Inv( const int a ) { return Qkpow( a, mod - 2 ); }

int main()
{
	read( N ), read( M ); int su = 0;
	rep( i, 1, N ) read( A[i] ), su += A[i];
	int prod = 1;
	rep( i, 1, su + N ) prod = Mul( prod, Mul( Inv( i ), M + N - i + 1 ) );
	write( prod ), putchar( '\n' );
	return 0;
}
#include<bits/stdc++.h>
#define it register int
#define ct const int
#define il inline
using namespace std;
const int N=1000005;
int p[N],cn,mn[N],n;
bool isp[N];
il int Min(ct p,ct q){return p<q?p:q;}
il void Pre(){
	it i,j,x;mn[1]=1;
	for(i=2;i<=n;++i){
		if(!isp[i]) p[++cn]=i,mn[i]=i;
		for(j=1;(x=p[j]*i)<=n;++j){
			isp[x]=1,mn[x]=Min(mn[i],p[j]);
			if(!(i%p[j])) break;
		}
	}
}
int main(){ 
	scanf("%d",&n),Pre();
	for(it i=1,j;i<=n;++i){
		it cnt=0;
		for(j=i;j>1;){
			it x=mn[j];
			while(j>1&&mn[j]==x) j/=x,++cnt;
			//++cnt;
		}
		printf("%d ",cnt+1);
	}
	return 0;
}
