#include <bits/stdc++.h>
using namespace std;
const int maxN = 100001, maxK = 100;
int T[maxN][maxK];
vector<int> G[maxN], vs[maxK];
queue<int> Q;
int main() {
  int n, m, k, s;
  scanf("%d%d%d%d", &n, &m, &k, &s);
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    vs[a - 1].push_back(i);
    for (int j = 0; j < k; j++) T[i][j] = n + 1;
  }
  while (m--) {
    int a, b;
    scanf("%d%d", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for (int i = 0; i < k; i++) {
    for (int v : vs[i]) Q.push(v), T[v][i] = 0;
    while (!Q.empty()) {
      int v = Q.front();
      Q.pop();
      for (int u : G[v]) {
        if (T[u][i] > T[v][i] + 1) {
          T[u][i] = T[v][i] + 1;
          Q.push(u);
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    int* p = &T[i][0];
    sort(p, p + k);
    int res = 0;
    for (int j = 0; j < s; j++) res += p[j];
    printf("%d ", res);
  }
  printf("\n");
  return 0;
}
