#include <bits/stdc++.h>
const int maxn = 1e5 + 1;
using namespace std;
int n, m, k, s, node;
int a[maxn];
vector<int> G[maxn];
int d[101][maxn];
bool vis[maxn];
vector<int> Goods[101];
void addedge(int from, int to) {
  G[from].push_back(to);
  G[to].push_back(from);
}
void solve(int st) {
  queue<int> q;
  for (int i = 1; i <= n; i++) {
    if (a[i] == st) {
      d[st][i] = 0;
      q.push(i);
    }
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < G[u].size(); i++) {
      int v = G[u][i];
      if (d[st][v] > d[st][u] + 1) {
        d[st][v] = d[st][u] + 1;
        q.push(v);
      }
    }
  }
}
int main() {
  scanf("%d%d%d%d", &n, &m, &k, &s);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), Goods[a[i]].push_back(i);
  int from, to;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &from, &to);
    addedge(from, to);
  }
  memset(d, 0x3f, sizeof(d));
  for (int i = 1; i <= k; i++) solve(i);
  int dist[maxn];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) dist[j] = d[j][i];
    sort(dist + 1, dist + k + 1);
    long long ans = 0;
    for (int j = 1; j <= s; j++) ans += dist[j];
    cout << ans << ' ';
  }
  return 0;
}
