#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, K = 101;
int n, m, k, s, arr[N], dist[N][K];
vector<int> g[N];
void calc(int x) {
  queue<pair<int, int> > q;
  for (int i = 1; i <= n; i++) {
    dist[i][x] = -1;
    if (arr[i] == x) dist[i][x] = 0, q.push({i, 0});
  }
  while (!q.empty()) {
    auto tmp = q.front();
    q.pop();
    int u = tmp.first, cc = tmp.second;
    if (dist[u][x] != -1 && cc > dist[u][x]) continue;
    for (int v : g[u])
      if (cc + 1 <= dist[v][x] || dist[v][x] == -1) {
        dist[v][x] = cc + 1;
        q.push({v, cc + 1});
      }
  }
}
int main() {
  scanf("%d %d %d %d", &n, &m, &k, &s);
  for (int i = 1; i <= n; i++) scanf("%d", &arr[i]);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= k; i++) calc(i);
  for (int i = 1; i <= n; i++) {
    vector<int> v;
    for (int j = 1; j <= k; j++) v.push_back(dist[i][j]);
    sort(v.begin(), v.end());
    printf("%d ", accumulate(v.begin(), v.begin() + s, 0));
  }
  return 0;
}
