#include<bits/stdc++.h>
#define ll long long
using namespace std;
int read()
{
	char c;
	int w=1;
	while((c=getchar())>'9'||c<'0')if(c=='-')w=-1;
	int ans=c-'0';
	while((c=getchar())>='0'&&c<='9')ans=(ans<<1)+(ans<<3)+c-'0';
	return ans*w;
}
int n;
ll X;
int a[105];
int b[105];
int f[105][105][105];
int vis[105][105][105];
int mod;
int red(int x)
{
	return x>=mod?x-mod:x;
}
void check(int a,int b,int c)
{
	if(vis[a][b][c]!=mod)
	{
		vis[a][b][c]=mod;
		f[a][b][c]=-1e9;
	}
}
int main(){
//	freopen("a.in","r",stdin);
	cin>>n>>X;
	for(int i=1;i<=n;i++)a[i]=read();
	ll ans=1e18;
	for(mod=1;mod<=n;mod++)
	{
		for(int i=1;i<=n;i++)b[i]=a[i]%mod;
		vis[0][0][0]=mod;
		for(int x=0;x<n;x++)
		{
			for(int i=max(0,mod-n+x);i<=x;i++)
			{
				for(int j=0;j<mod;j++)
				{
					if(vis[x][i][j]!=mod)continue;
//					cout<<x<<" "<<i<<" "<<j<<" "<<f[x][i][j]<<endl;
					int o=red(j+b[x+1]);
					check(x+1,i,j);
					check(x+1,i+1,o);
					f[x+1][i][j]=max(f[x+1][i][j],f[x][i][j]);
					f[x+1][i+1][o]=max(f[x+1][i+1][o],f[x][i][j]+a[x+1]);
				}
			}
		}
		int s=X%mod;
		if(vis[n][mod][s]!=mod)continue;
//		cout<<mod<<" "<<f[n][mod][s]<<endl;
		ans=min(ans,(X-f[n][mod][s])/mod);
	}
	cout<<ans<<endl;
	return 0;
}
#include<bits/stdc++.h>

typedef   long long  int ll;
typedef  long double ld;
typedef std::vector<ll> vi;
typedef std::vector<std::vector<ll> > vv;
typedef std::vector<std::pair<ll,ll> > pii;

#define mod 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,b) for(i=a;i<b;i++)
#define forr(i,a,b) for(i=a;i>=b;i--)
#define mp make_pair
#define pb(x) push_back(x)
#define fi first
#define se second
#define print(vec,a,b) for(ll i=a;i<b;i++) cout<<vec[i]<<" ";cout<<endl;
#define all(a) a.begin(),a.end()
#define input(vec,a,b) for(ll i = a;i<b;i++) cin>>vec[i];
#define ms(a,val) memset(a,val,sizeof(a))
using namespace std;

const int N = 2e5+ 5;



ll expo_pow(ll x, ll y) {
	if (y == 0)
		return 1;
	y = y % (mod - 1);
	x %= mod;
	if (y == 0)
		y = mod - 1;
	ll res = 1;
	while (y) {
		if (y & 1)
			res = (res * x) % mod;
		x = (x * x) % mod;
		y >>= 1;
	}
	return res;
}
 
ll modInverse(ll a, ll m = mod) {
	return expo_pow(a, m - 2);
}
	

using matrix = vector<vector<ll>>;
 
matrix matMul(matrix A, matrix B) {
	//assert((int)A[0].size() == (int)B.size());
	matrix res((ll)A.size(), vector<ll>((ll)B[0].size(), 0));
	for (int i = 0; i < (int)A.size(); ++i) {
		for (int j = 0; j < (int)B[0].size(); ++j) {
			for (int k = 0; k < (int)A[0].size(); ++k) {
				res[i][j] += (A[i][k] * B[k][j]) % mod;
				res[i][j] %= mod;
			}
		}
	}
	return res;
}
 
matrix matPow(matrix M, int p) {
	if (p == 1) return M;
	if (p % 2) return matMul(M, matPow(M, p - 1));
	matrix X = matPow(M, p / 2);
	return matMul(X, X);
}

void solve(){
            ll i,j,n,m,k;
            cin>>n>>m>>k;
            
            vv a(1,vi(n,0));
            input(a[0],0,n);
            vv adj(n,vector<ll>(n,0));
            
            vi deg(n,0);
            fo(i,0,m)
            {
				ll x,y;
				cin>>x>>y;
				x--,y--;
				adj[x][y] = 1;
				adj[y][x] = 1;
				deg[x]++;
				deg[y]++;
			}
			
			ll inv = modInverse(2*m,mod);
			
			vv M(n,vi(n,0));
			
			
			
			if(k == 0)
			{
				print(a[0],0,n);
				return ;
			}
			fo(i,0,n)
			{
				fo(j,0,n)
				{
					if(i == j)
					{
						M[i][j] = (1 - (deg[i]*inv)%mod + mod)%mod;
					}
					else
					{
						M[i][j] = inv*adj[i][j];
					}
				}
			}
			M = matPow(M, k);
			a = matMul(a,M);
			fo(i,0,n)
			{
				cout<<a[0][i]<<endl;
			}
}



int main()
{
     IO;
      ll t=1,i;
      //cin>>t;

		
      while(t--)
      {

          solve();
      }
    return 0;
}
