#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &t) {
  char ch = getchar();
  int f = 1;
  while ('0' > ch || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  t = 0;
  do {
    (t *= 10) += ch - '0';
    ch = getchar();
  } while ('0' <= ch && ch <= '9');
  t *= f;
}
const int maxn = 100010;
const int INF = 1 << 30;
int n, m, k, s, c[maxn];
vector<int> g[maxn];
bool vis[maxn];
long long ans;
queue<int> q;
int dis[maxn][110];
void bfs(int x) {
  memset(vis, 0, sizeof(vis));
  q = queue<int>();
  for (int i = 1; i <= n; i++) {
    dis[i][x] = INF;
    if (c[i] == x) {
      dis[i][x] = 0;
      q.push(i);
      vis[i] = 1;
    }
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < g[u].size(); i++) {
      int v = g[u][i];
      if (vis[v]) continue;
      dis[v][x] = dis[u][x] + 1;
      q.push(v);
      vis[v] = 1;
    }
  }
}
int main() {
  read(n);
  read(m);
  read(k);
  read(s);
  for (int i = 1; i <= n; i++) read(c[i]);
  for (int i = 1; i <= m; i++) {
    int u, v;
    read(u);
    read(v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= k; i++) bfs(i);
  for (int i = 1; i <= n; i++) {
    sort(dis[i] + 1, dis[i] + k + 1);
    ans = 0;
    for (int j = 1; j <= s; j++) ans += (long long)dis[i][j];
    printf("%I64d\n", ans);
  }
  return 0;
}
