#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
long long mod = 1e9 + 7;
int k;
int buc[110];
int val[N][110];
int A[N];
const int INF = 1e9 + 7;
vector<int> adj[N];
vector<int> v[N];
int vis[N];
queue<int> q;
void bfs(int i) {
  for (auto ve : v[i]) {
    q.push(ve);
    val[ve][i] = 0;
  }
  while (!q.empty()) {
    int tp = q.front();
    q.pop();
    for (auto ve : adj[tp]) {
      if (val[tp][i] + 1 < val[ve][i]) {
        val[ve][i] = val[tp][i] + 1;
        q.push(ve);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1, n, i, j;
  int m, second, u, vi;
  cin >> n >> m >> k >> second;
  for (i = 1; i <= n; i++) {
    cin >> A[i];
    v[A[i]].push_back(i);
    for (j = 1; j <= k + 1; j++) {
      val[i][j] = INF;
    }
  }
  for (i = 1; i <= m; i++) {
    cin >> u >> vi;
    adj[u].push_back(vi);
    adj[vi].push_back(u);
  }
  for (int j = 1; j <= k; j++) bfs(j);
  for (int i = 1; i <= n; i++) {
    sort(val[i] + 1, val[i] + k + 1);
    int ans = 0;
    for (int j = 1; j <= second; j++) ans += val[i][j];
    cout << ans << " ";
  }
  cout << "\n";
  return 0;
}
