#include <bits/stdc++.h>
using namespace std;
int n, m, s, k, g[100005], q[105][100005], cnt[105], ch[105][100005],
    d[105][100005], save[100005];
vector<int> v[100005];
int main() {
  int i, j, a, b, f, r;
  scanf("%d %d %d %d", &n, &m, &k, &s);
  for (i = 1; i <= n; i++) {
    scanf("%d", g + i);
    q[g[i]][++cnt[g[i]]] = i;
    ch[g[i]][i] = 1;
  }
  for (i = 1; i <= m; i++) {
    scanf("%d %d", &a, &b);
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (i = 1; i <= k; i++) {
    f = 1;
    r = cnt[i];
    while (f <= r) {
      for (j = 0; j < v[q[i][f]].size(); j++) {
        if (ch[i][v[q[i][f]][j]]) continue;
        q[i][++r] = v[q[i][f]][j];
        ch[i][v[q[i][f]][j]] = 1;
        d[i][v[q[i][f]][j]] = d[i][q[i][f]] + 1;
      }
      f++;
    }
  }
  for (i = 1; i <= n; i++) {
    long long ans = 0;
    for (j = 1; j <= k; j++) save[j] = d[j][i];
    sort(save + 1, save + k + 1);
    for (j = 1; j <= s; j++) ans += save[j];
    printf("%lld ", ans);
  }
  return 0;
}
