#include <bits/stdc++.h>
using namespace std;
int n, m, k, s;
vector<int> G[100005];
vector<int> A[105];
vector<int> res[100005];
int d[100005];
int u, v;
int var;
int main() {
  scanf("%d%d%d%d", &n, &m, &k, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &var);
    A[var].push_back(i);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  queue<int> q;
  int p;
  for (int i = 1; i <= k; i++) {
    while (!q.empty()) q.pop();
    memset(d, 0x3f, sizeof(d));
    for (int j = 0; j < A[i].size(); j++) q.push(A[i][j]), d[A[i][j]] = 0;
    while (!q.empty()) {
      p = q.front();
      q.pop();
      for (int j = 0; j < G[p].size(); j++) {
        if (d[G[p][j]] > d[p] + 1) {
          d[G[p][j]] = d[p] + 1;
          q.push(G[p][j]);
        }
      }
    }
    for (int i = 1; i <= n; i++) res[i].push_back(d[i]);
  }
  int temp;
  for (int i = 1; i <= n; i++) {
    sort(res[i].begin(), res[i].end());
    temp = 0;
    for (int j = 0; j < s; j++) temp += res[i][j];
    printf("%d", temp);
    if (i == n)
      printf("\n");
    else
      printf(" ");
  }
  return 0;
}
