#include <bits/stdc++.h>
using namespace std;
void Weapons19() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int32_t main() {
  Weapons19();
  long long n, m, k, s;
  cin >> n >> m >> k >> s;
  vector<long long> qq(n + 1);
  for (long long i = 1; i <= n; i++) cin >> qq[i];
  vector<vector<long long>> v(n + 1);
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  vector<vector<long long>> ans(n + 1);
  for (long long i = 1; i <= k; i++) {
    queue<long long> q;
    vector<long long> vis(n + 1, 0);
    for (long long j = 1; j <= n; j++) {
      if (qq[j] == i) {
        q.push(j);
        vis[j] = 1;
      }
    }
    while (!q.empty()) {
      long long t = q.front();
      q.pop();
      for (long long j = 0; j < v[t].size(); j++) {
        if (vis[v[t][j]] == 0) {
          vis[v[t][j]] = vis[t] + 1;
          q.push(v[t][j]);
        }
      }
    }
    for (long long i = 1; i <= n; i++) ans[i].push_back(vis[i] - 1);
  }
  for (long long i = 1; i <= n; i++) {
    long long x = 0;
    sort(ans[i].begin(), ans[i].end());
    for (long long j = 0; j < s; j++) x += ans[i][j];
    cout << x << " ";
  }
}
