#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 5;
const int K = 102;
int n, m, k, s;
vector<int> adj[N];
int a[N];
vector<int> type[K];
int dist[N];
int dp[N][K];
void testcase() {
  cin >> n >> m >> k >> s;
  for (int i = 1; i <= (n); ++i) {
    cin >> a[i];
    type[a[i]].push_back(i);
  }
  for (int i = 1; i <= (m); ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= (k); ++i) {
    for (int j = 1; j <= (n); ++j) dist[j] = INT_MAX;
    queue<int> q;
    for (int x : type[i]) {
      q.push(x);
      dist[x] = 0;
    }
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      for (int v : adj[u]) {
        if (dist[v] > dist[u] + 1) {
          dist[v] = dist[u] + 1;
          q.push(v);
        }
      }
    }
    for (int j = 1; j <= (n); ++j) {
      dp[j][i] = dist[j];
    }
  }
  for (int i = 1; i <= (n); ++i) {
    sort(dp[i], dp[i] + k + 1);
    int ans = 0;
    for (int j = 1; j <= (s); ++j) {
      ans += dp[i][j];
    }
    cout << ans << " ";
  }
  cout << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  if (0) cin >> t;
  while (t--) {
    testcase();
  }
  return 0;
}
