#include <bits/stdc++.h>
using namespace std;
int n, m, s, k;
const int maxn = 1e5 + 10;
struct Edge {
  int to, w, next;
} edge[maxn * 2];
int head[maxn * 2];
int a[maxn];
int cnt;
void add_edge(int from, int to, int w) {
  edge[cnt].to = to;
  edge[cnt].w = w;
  edge[cnt].next = head[from];
  head[from] = cnt++;
}
int type[110][maxn];
int typecnt[110];
int dis[maxn][200];
void init() {
  cnt = 0;
  memset(head, -1, sizeof head);
  memset(typecnt, 0, sizeof typecnt);
  memset(dis, 0x3f3f3f3f, sizeof dis);
}
void cal_dist(int tp) {
  queue<int> qu;
  for (int i = 0; i < typecnt[tp]; i++) {
    qu.push(type[tp][i]);
    dis[type[tp][i]][tp] = 0;
  }
  while (qu.size()) {
    int p = qu.front();
    qu.pop();
    for (int i = head[p]; i != -1; i = edge[i].next) {
      int to = edge[i].to;
      if (dis[to][tp] == 0x3f3f3f3f) {
        dis[to][tp] = dis[p][tp] + 1;
        qu.push(to);
      }
    }
  }
}
int main() {
  while (scanf("%d%d%d%d", &n, &m, &k, &s) == 4) {
    init();
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      type[a[i]][typecnt[a[i]]++] = i;
    }
    for (int i = 1; i <= m; i++) {
      int pp, qq;
      scanf("%d%d", &pp, &qq);
      add_edge(pp, qq, 1);
      add_edge(qq, pp, 1);
    }
    for (int i = 1; i <= k; i++) {
      cal_dist(i);
    }
    for (int i = 1; i <= n; i++) {
      sort(dis[i] + 1, dis[i] + k + 1);
      int sum = 0;
      for (int j = 1; j <= s; j++) sum += dis[i][j];
      printf("%d ", sum);
    }
    printf("\n");
  }
  return 0;
}
