#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
const int INF = 0x3f3f3f3f;
int a[maxn], dis[110][maxn], n;
int head[maxn], To[maxn * 200], Next[maxn * 200], cnt, d[maxn];
void add(int u, int v) {
  Next[++cnt] = head[u];
  head[u] = cnt;
  To[cnt] = v;
}
void bfs(int x) {
  queue<int> q;
  for (int i = 1; i <= n; i++)
    if (a[i] == x) {
      q.push(i);
      dis[x][i] = 0;
    }
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int i = head[v]; i; i = Next[i]) {
      if (dis[x][To[i]] > dis[x][v] + 1) {
        dis[x][To[i]] = dis[x][v] + 1;
        q.push(To[i]);
      }
    }
  }
}
int main() {
  int m, k, s, u, v;
  scanf("%d %d %d %d", &n, &m, &k, &s);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(dis, INF, sizeof(dis));
  while (m--) {
    scanf("%d %d", &u, &v);
    add(u, v);
    add(v, u);
  }
  for (int i = 1; i <= k; i++) bfs(i);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) d[j] = dis[j][i];
    sort(d + 1, d + 1 + k);
    int res = 0;
    for (int j = 1; j <= s; j++) res += d[j];
    printf("%d ", res);
  }
}
