#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const int M = 107;
const int inf = 1e9 + 7;
vector<int> g[N], a[M];
int w[N][M], d[N];
void bfs(int u) {
  queue<int> q;
  memset(d, inf, sizeof(d));
  for (int i = 0; i < (int)a[u].size(); ++i) {
    q.push(a[u][i]);
    d[a[u][i]] = 0;
  }
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    w[v][u] = d[v];
    for (int i = 0; i < (int)g[v].size(); ++i) {
      int to = g[v][i];
      if (d[to] > d[v] + 1) {
        d[to] = d[v] + 1;
        q.push(to);
      }
    }
  }
}
int main() {
  int n, m, k, second;
  scanf("%d %d %d %d", &n, &m, &k, &second);
  for (int i = 1, x; i <= n; ++i) {
    scanf("%d", &x);
    a[x].push_back(i);
  }
  for (int i = 0, u, v; i < m; ++i) {
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= k; ++i) bfs(i);
  for (int i = 1; i <= n; ++i) {
    sort(w[i] + 1, w[i] + k + 1);
    int ans = 0;
    for (int j = 1; j <= second; ++j) ans += w[i][j];
    printf("%d ", ans);
  }
  return 0;
}
