#include <bits/stdc++.h>
using namespace std;
int n, m, K, S;
vector<int> ans[100010];
vector<int> vec[110];
int e[200010][2], p[100010];
int q[100010], dis[100010];
void adde(int sn, int fn, int id) {
  e[id][0] = fn;
  e[id][1] = p[sn];
  p[sn] = id;
}
void bfs(vector<int> &vec) {
  int head = 1, tail = 1;
  int i, sn, fn;
  memset(dis, 0, sizeof(int) * (n + 3));
  for (i = 0; i < vec.size(); i++) q[tail++] = vec[i], dis[vec[i]] = 1;
  while (head < tail) {
    sn = q[head++];
    ans[sn].push_back(dis[sn] - 1);
    for (i = p[sn]; i; i = e[i][1]) {
      if (dis[fn = e[i][0]]) continue;
      dis[fn] = dis[sn] + 1;
      q[tail++] = fn;
    }
  }
}
int main() {
  int i, j, x, sn, fn;
  long long sum;
  scanf("%d%d%d%d", &n, &m, &K, &S);
  for (i = 1; i <= n; i++) scanf("%d", &x), vec[x].push_back(i);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &sn, &fn);
    adde(sn, fn, i << 1);
    adde(fn, sn, i << 1 | 1);
  }
  for (i = 1; i <= K; i++) bfs(vec[i]);
  for (i = 1; i <= n; i++) {
    sort(ans[i].begin(), ans[i].end());
    for (j = 0, sum = 0; j < S; j++) sum += ans[i][j];
    printf("%lld%c", sum, "\n "[i < n]);
  }
  return 0;
}
