#include <bits/stdc++.h>
using namespace std;
int a[100005], dist[100005][105], q[100005], ans[1000005], start, endd;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, k, s;
  cin >> n >> m >> k >> s;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) --a[i];
  vector<vector<int>> g(n);
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    g[--u].push_back(--v);
    g[v].push_back(u);
  }
  for (int i = 0; i < k; ++i) {
    start = endd = 0;
    for (int j = 0; j < n; ++j) {
      dist[j][i] = 10000007;
      if (a[j] == i) {
        dist[j][i] = 0;
        q[endd++] = j;
      }
    }
    while (start < endd) {
      int u = q[start++];
      for (int v : g[u]) {
        if (dist[v][i] > dist[u][i] + 1) {
          dist[v][i] = dist[u][i] + 1;
          q[endd++] = v;
        }
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    sort(dist[i], dist[i] + k);
    for (int j = 0; j < s; ++j) {
      ans[i] += dist[i][j];
    }
  }
  for (int i = 0; i < n; ++i) cout << ans[i] << ' ';
  cout << endl;
}
