#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
struct node {
  int next, to;
} g[N << 1];
vector<int> c[N];
int head[N], cnt;
int dist[N][110];
int col[N];
int n, m, k, s;
int ans;
inline void addedge(int u, int v) {
  g[++cnt].next = head[u];
  g[cnt].to = v;
  head[u] = cnt;
}
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
void bfs(int color) {
  queue<int> q;
  for (int i = 0; i < c[color].size(); i++)
    q.push(c[color][i]), dist[c[color][i]][color] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = head[u]; i; i = g[i].next) {
      int v = g[i].to;
      if (dist[v][color] == -1) {
        dist[v][color] = dist[u][color] + 1;
        q.push(v);
      }
    }
  }
}
int main() {
  n = read();
  m = read();
  k = read();
  s = read();
  for (int i = 1; i <= n; i++) {
    col[i] = read();
    c[col[i]].push_back(i);
  }
  for (int i = 1; i <= m; i++) {
    int x = read(), y = read();
    addedge(x, y);
    addedge(y, x);
  }
  memset(dist, -1, sizeof(dist));
  for (int i = 1; i <= k; i++) {
    bfs(i);
  }
  for (int i = 1; i <= n; i++) {
    ans = 0;
    sort(dist[i] + 1, dist[i] + 1 + k);
    for (int j = 1; j <= s; j++) ans += dist[i][j];
    printf("%d ", ans);
  }
}
