#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define F1(x,y,z) for(int x=y;xz;x--) #define F4(x,y,z) for(int x=y;x>=z;x--) #define pb push_back #define LL long long #define co complex #define MAX 100005 #define AMAX 1500 #define MOD 1000000007 #define f(c,d) ((1<<(c))*(d)) using namespace std; int t,n,k; vector x[MAX]; LL y[MAX],fa[MAX],in[MAX],ans; LL po(LL b,LL p){ if(p==0)return 1; if(p&1)return po(b,p-1)*b%MOD; LL tt=po(b,p/2); return tt*tt%MOD; } LL ncr(LL a,LL b){ return fa[a]*in[b]%MOD*in[a-b]%MOD; } LL go(int a){ if(a==1)return 1; LL tt=0; F1(b,0,min(k,(int)x[a].size())){ tt+=x[a][b]*ncr(k,b+1)%MOD; tt%=MOD; } return tt; } int main(){ fa[0]=1; F1(a,1,MAX)fa[a]=fa[a-1]*a%MOD; F1(a,0,MAX)in[a]=po(fa[a],MOD-2); F1(a,2,MAX){ x[a].pb(1); F1(b,2,MAX){ if(b*b>a)break; if(a%b==0){ while(x[a].size()<=x[b].size())x[a].pb(0); F1(c,0,x[b].size())x[a][c+1]=(x[a][c+1]+x[b][c])%MOD; if(b*b!=a){ while(x[a].size()<=x[a/b].size())x[a].pb(0); F1(c,0,x[a/b].size())x[a][c+1]=(x[a][c+1]+x[a/b][c])%MOD; } } } } scanf("%d",&t); while(t--){ scanf("%d%d",&n,&k); F2(a,1,n)scanf("%I64d",&y[a]); printf("%I64d",y[1]); F2(a,2,n){ ans=0; F1(b,1,MAX){ if(b*b>a)break; if(a%b==0){ ans+=y[b]*go(a/b)%MOD; if(b*b!=a)ans+=y[a/b]*go(b)%MOD; ans%=MOD; } } printf(" %I64d",ans); } printf("\n"); } //system("pause"); }