#include <bits/stdc++.h>
using namespace std;
int n, m, k, s;
int arr[100011];
long dp[100011][111];
vector<int> adj[100011];
int main() {
  cin >> n >> m >> k >> s;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    for (int j = 0; j < 101; j++) dp[i][j] = 10000000;
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  queue<pair<int, pair<int, int> > > q;
  for (int i = 0; i < n; i++) {
    q.push({i, {arr[i], 0}});
    dp[i][arr[i]] = 0;
  }
  while (!q.empty()) {
    int v = q.front().first, idx = q.front().second.first,
        dist = q.front().second.second;
    q.pop();
    for (int i = 0; i < (int)adj[v].size(); i++) {
      int u = adj[v][i];
      if (dp[u][idx] > dist + 1) {
        dp[u][idx] = dist + 1;
        q.push({u, {idx, dist + 1}});
      }
    }
  }
  for (int i = 0; i < n; i++) {
    vector<long> tmp;
    for (int j = 0; j < k; j++) {
      tmp.push_back(dp[i][j + 1]);
    }
    sort(tmp.begin(), tmp.end());
    long ans = 0;
    for (int j = 0; j < s; j++) ans += tmp[j];
    cout << ans << " ";
  }
  return 0;
}
