#include <bits/stdc++.h>
using namespace std;
vector<int> mp[100001];
int a[100001];
int vis[100001];
int dis[100001][101];
queue<pair<int, int> > q;
priority_queue<int> pq;
int main() {
  int n, m, k, s, u, v, x, step, ans;
  scanf("%d%d%d%d", &n, &m, &k, &s);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &u, &v);
    mp[u].push_back(v);
    mp[v].push_back(u);
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++)
      if (a[j] == i) {
        q.push(make_pair(j, 0));
        vis[j] = i;
      }
    while (!q.empty()) {
      x = q.front().first;
      step = q.front().second;
      q.pop();
      dis[x][i] = step;
      for (int j = 0; j < mp[x].size(); j++)
        if (vis[mp[x][j]] != i) {
          q.push(make_pair(mp[x][j], step + 1));
          vis[mp[x][j]] = i;
        }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++)
      if (pq.size() < s)
        pq.push(dis[i][j]);
      else if (dis[i][j] < pq.top()) {
        pq.pop();
        pq.push(dis[i][j]);
      }
    ans = 0;
    while (!pq.empty()) {
      ans += pq.top();
      pq.pop();
    }
    if (i != n)
      printf("%d ", ans);
    else
      printf("%d\n", ans);
  }
  return 0;
}
