#include <bits/stdc++.h>
using namespace std;
template <typename T>
class MinPq : public priority_queue<T, vector<T>, greater<T> > {};
template <typename T>
class MaxPq : public priority_queue<T, vector<T>, less<T> > {};
vector<int> graph[100001];
int a[100001], goodmap[100001][101];
bool visited[100001];
void bfs(int k, int n) {
  queue<pair<int, int> > q;
  int i;
  memset(visited + 1, 0, sizeof(bool) * n);
  for (i = 1; i <= n; i++) {
    if (a[i] == k) {
      q.push(make_pair(i, 0));
      visited[i] = true;
    }
  }
  while (!q.empty()) {
    pair<int, int> t = q.front();
    q.pop();
    goodmap[t.first][k] = t.second;
    for (int child : graph[t.first]) {
      if (!visited[child]) {
        visited[child] = true;
        q.push(make_pair(child, t.second + 1));
      }
    }
  }
}
int main() {
  int i, j, n, m, k, s;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k >> s;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  for (i = 1; i <= k; i++) bfs(i, n);
  for (i = 1; i <= n; i++) {
    MinPq<int> pq;
    int ans = 0;
    for (j = 1; j <= k; j++) pq.push(goodmap[i][j]);
    for (j = 0; j < s; j++, pq.pop()) ans += pq.top();
    cout << ans << " ";
  }
  return 0;
}
