#include <bits/stdc++.h>
using namespace std;
int n, m, k, s;
int D[110][101000], Q[101000];
vector<int> G[110], E[101000];
int w[101000], v[101000];
void BFS(int a) {
  int i;
  for (i = 1; i <= n; i++) {
    v[i] = 0;
    D[a][i] = 1e9;
  }
  int f = 0, r = 0;
  for (int l = 0; l < G[a].size(); l++) {
    int x = G[a][l];
    Q[++r] = x;
    v[x] = 1;
    D[a][x] = 0;
  }
  while (f < r) {
    int x = Q[++f];
    for (int l = 0; l < E[x].size(); l++) {
      int y = E[x][l];
      if (!v[y]) {
        v[y] = 1;
        Q[++r] = y;
        D[a][y] = D[a][x] + 1;
      }
    }
  }
}
int main() {
  int i, j;
  scanf("%d%d%d%d", &n, &m, &k, &s);
  for (i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
    G[w[i]].push_back(i);
  }
  for (i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    E[a].push_back(b);
    E[b].push_back(a);
  }
  for (i = 1; i <= k; i++) BFS(i);
  for (i = 1; i <= n; i++) {
    vector<int> T;
    for (j = 1; j <= k; j++) T.push_back(D[j][i]);
    sort(T.begin(), T.end());
    long long res = 0;
    for (j = 0; j < s; j++) res += T[j];
    cout << res << " ";
  }
  cout << "\n";
  return 0;
}
