#include <bits/stdc++.h>
using namespace std;
int dist[100001][101];
int ty[100001];
vector<int> connect[100001];
int main() {
  int n, m, k, s;
  cin >> n >> m >> k >> s;
  for (int i = 1; i <= n; i++) cin >> ty[i];
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    connect[a].push_back(b);
    connect[b].push_back(a);
  }
  queue<int> q;
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) dist[j][i] = -1;
    for (int j = 1; j <= n; j++)
      if (ty[j] == i) {
        q.push(j);
        dist[j][i] = 0;
      }
    while (!q.empty()) {
      int cur = q.front();
      q.pop();
      for (int j = 0; j < connect[cur].size(); j++) {
        if (dist[connect[cur][j]][i] == -1) {
          q.push(connect[cur][j]);
          dist[connect[cur][j]][i] = dist[cur][i] + 1;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    sort(dist[i] + 1, dist[i] + k + 1);
    int ans = 0;
    for (int j = 1; j <= s; j++) ans += dist[i][j];
    cout << ans << ' ';
  }
  return 0;
}
