#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int u, v, nxt;
} e[100000 + 5 << 1];
int a[100000 + 5][100 + 5], head[100000 + 5], b[100000 + 5], dis[100000 + 5],
    app[100000 + 5];
int n, m, k, s, ind;
queue<int> q;
void addedge(int x, int y) {
  e[ind] = (Edge){x, y, head[x]}, head[x] = ind++;
  e[ind] = (Edge){y, x, head[y]}, head[y] = ind++;
}
void bfs(int pos) {
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = head[x]; i != -1; i = e[i].nxt)
      if (!app[e[i].v]) {
        a[e[i].v][pos] = a[x][pos] + 1;
        app[e[i].v] = 1;
        q.push(e[i].v);
      }
  }
}
int main() {
  scanf("%d%d%d%d", &n, &m, &k, &s);
  memset(head, -1, sizeof(head));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
  }
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    addedge(x, y);
  }
  for (int i = 1; i <= k; i++) {
    while (!q.empty()) q.pop();
    memset(app, 0, sizeof(app));
    for (int j = 1; j <= n; j++)
      if (b[j] == i) q.push(j), app[j] = 1;
    bfs(i);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    sort(a[i] + 1, a[i] + 1 + k);
    ans = 0;
    for (int j = 1; j <= s; j++) {
      ans += a[i][j];
    }
    printf("%d ", ans);
  }
  return 0;
}
