#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long int INFL = 1e18;
const int MAX_N = 1e5;
int types[MAX_N];
int dist[MAX_N][101];
bool used[101];
vector<int> G[MAX_N];
int main(void) {
  cin.sync_with_stdio(false), cin.tie(NULL);
  int N, M, K, S;
  cin >> N >> M >> K >> S;
  memset(dist, -1, sizeof dist);
  for (int i = 0; i < N; i++) {
    cin >> types[i];
  }
  int u, v;
  for (int i = 0; i < M; i++) {
    cin >> u >> v;
    u--, v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= 100; i++) {
    queue<int> q;
    for (int j = 0; j < N; j++)
      if (types[j] == i) {
        q.push(j);
        dist[j][i] = 0;
      }
    if (!q.empty()) used[i] = true;
    while (!q.empty()) {
      int cur = q.front();
      q.pop();
      for (int next : G[cur]) {
        if (dist[next][i] == -1) {
          dist[next][i] = dist[cur][i] + 1;
          q.push(next);
        }
      }
    }
  }
  for (int i = 0; i < N; i++) {
    priority_queue<int> pq;
    for (int j = 1; j <= K; j++)
      if (used[j]) {
        pq.push(dist[i][j]);
        if (pq.size() > S) pq.pop();
      }
    int sum = 0;
    while (!pq.empty()) {
      sum += pq.top();
      pq.pop();
    }
    cout << sum << ' ';
  }
  return 0;
}
