#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, s, k;
  cin >> n >> m >> k >> s;
  long long goods[100010];
  set<long long> uni;
  vector<long long> starts[105];
  vector<long long> nodes[100010];
  int visit[100010];
  vector<long long> rcvd[100010];
  for (long long i = 0; i < n; i++) {
    cin >> goods[i];
    uni.insert(goods[i]);
    starts[goods[i]].push_back(i + 1);
  }
  long long a, b;
  for (long long i = 0; i < m; i++) {
    cin >> a >> b;
    nodes[a].push_back(b);
    nodes[b].push_back(a);
  }
  for (auto i : uni) {
    memset(visit, 0, sizeof(visit));
    queue<pair<long long, long long> > q;
    for (auto j : starts[i]) {
      q.push(make_pair(j, 0));
    }
    while (!q.empty()) {
      pair<long long, long long> p = q.front();
      q.pop();
      long long node = p.first;
      long long dist = p.second;
      if (visit[node] == 0) {
        visit[node] = 1;
        for (auto a : nodes[node]) {
          if (visit[a] == 0) q.push(make_pair(a, dist + 1));
        }
        rcvd[node].push_back(dist);
      }
    }
  }
  for (long long i = 1; i <= n; i++) {
    long long ans = 0;
    sort(rcvd[i].begin(), rcvd[i].end());
    for (long long j = 0; j < s; j++) ans += rcvd[i][j];
    cout << ans << " ";
  }
  return 0;
}
