#include <bits/stdc++.h>
using namespace std;
void qmax(long long &x, int y) {
  if (x < y) x = y;
}
void qmin(long long &x, long long y) {
  if (x > y) x = y;
}
inline long long read() {
  char s;
  long long k = 0, base = 1;
  while ((s = getchar()) != '-' && s != EOF && !(isdigit(s)))
    ;
  if (s == EOF) exit(0);
  if (s == '-') base = -1, s = getchar();
  while (isdigit(s)) {
    k = k * 10 + (s ^ '0');
    s = getchar();
  }
  return k * base;
}
inline void write(int x) {
  static char cnt, num[15];
  cnt = 0;
  if (!x) {
    printf("0");
    return;
  }
  for (; x; x /= 10) num[++cnt] = x % 10;
  for (; cnt; putchar(num[cnt--] + 48))
    ;
}
const int maxn = 1e5 + 100;
int n, m, k, s, X, Y;
int a[maxn];
int po[maxn], ne[maxn * 2], to[maxn * 2], id;
void add(int x, int y) {
  id++;
  to[id] = y;
  ne[id] = po[x];
  po[x] = id;
}
int dis[maxn], vis[maxn];
queue<int> q;
int c[maxn][101];
void spfa(int x) {
  memset(vis, 0, sizeof(vis));
  memset(dis, 0x3f3f3f3f, sizeof(dis));
  int inf = dis[0];
  while (!q.empty()) q.pop();
  for (int i = 1; i <= n; i++)
    if (a[i] == x) {
      dis[i] = 0;
      vis[i] = 1;
      q.push(i);
    }
  while (!q.empty()) {
    int u = q.front(), v;
    q.pop();
    vis[u] = 0;
    for (int i = po[u]; i; i = ne[i]) {
      v = to[i];
      if (dis[v] > dis[u] + 1) {
        dis[v] = dis[u] + 1;
        if (!vis[v]) {
          vis[v] = 1;
          q.push(v);
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) c[i][x] = dis[i];
}
int main() {
  n = read();
  m = read();
  k = read();
  s = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= m; i++) {
    X = read();
    Y = read();
    add(X, Y);
    add(Y, X);
  }
  for (int i = 1; i <= k; i++) spfa(i);
  for (int i = 1; i <= n; i++) {
    long long sum = 0;
    sort(c[i] + 1, c[i] + k + 1);
    for (int j = 1; j <= s; j++) sum += c[i][j];
    printf("%lld ", sum);
  }
}
