#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
struct edge {
  int to, next;
} e[maxn << 2];
int head[maxn], cnt = 1;
void add(int u, int v) {
  e[++cnt].next = head[u];
  e[cnt].to = v;
  head[u] = cnt;
}
int d[maxn][105], a[maxn], ans[maxn];
int main() {
  int n, m, k, s;
  scanf("%d%d%d%d", &n, &m, &k, &s);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    add(n + a[i], i);
  }
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(u, v);
    add(v, u);
  }
  memset(d, -1, sizeof(d));
  for (int u = 1; u <= k; ++u) {
    queue<int> q;
    q.push(n + u);
    d[n + u][u] = 0;
    while (!q.empty()) {
      int f = q.front();
      q.pop();
      for (int i = head[f]; i; i = e[i].next) {
        int to = e[i].to;
        if (d[to][u] == -1) {
          d[to][u] = d[f][u] + 1;
          q.push(to);
        }
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    nth_element(d[i] + 1, d[i] + 1 + s, d[i] + 1 + k);
    int t = 0;
    for (int j = 1; j <= s; ++j) {
      t += d[i][j] - 1;
    }
    printf("%d ", t);
  }
  return 0;
}
