#include <bits/stdc++.h>
using namespace std;
vector<int> v[122];
vector<int> E[100005];
vector<int> Min[100005];
void bfs(int k) {
  queue<int> Q;
  for (int i = 0; i < v[k].size(); i++) {
    Min[v[k][i]][k - 1] = 0;
    Q.push(v[k][i]);
  }
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    for (int V : E[u]) {
      if (Min[V][k - 1] == -1) {
        Min[V][k - 1] = Min[u][k - 1] + 1;
        Q.push(V);
      }
    }
  }
}
int main(void) {
  int node, edge, k, s;
  scanf("%d%d%d%d", &node, &edge, &k, &s);
  for (int i = 1; i <= node; i++) {
    int x;
    scanf("%d", &x);
    v[x].push_back(i);
  }
  for (int i = 0; i < edge; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    E[x].push_back(y);
    E[y].push_back(x);
  }
  for (int i = 1; i <= node; i++) Min[i] = vector<int>(k, -1);
  for (int i = 1; i <= k; i++) bfs(i);
  for (int i = 1; i <= node; i++) {
    sort(Min[i].begin(), Min[i].end());
    int sum = 0;
    for (int j = 0; j < s; j++) sum += Min[i][j];
    printf("%d ", sum);
  }
  puts("");
  return 0;
}
