#include <bits/stdc++.h>
using namespace std;
int koszt[100010][101];
int type[100010];
int odl[100010] = {0};
int n, m, k, s;
vector<int> graf[100010];
queue<int> kolejka;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k >> s;
  for (int i = 1; i <= (n); i++) cin >> type[i];
  for (int I = 0; I < (m); ++I) {
    int t1, t2;
    cin >> t1 >> t2;
    graf[t1].push_back(t2);
    graf[t2].push_back(t1);
  }
  for (int i = 1; i <= (n); i++)
    for (int j = 1; j <= (k); j++) koszt[i][j] = 2000000011;
  for (int t = 1; t <= (k); t++) {
    for (int v = 1; v <= (n); v++) {
      if (type[v] == t) {
        kolejka.push(v);
        odl[v] = 0;
      } else
        odl[v] = 2000000011;
    }
    while (!kolejka.empty()) {
      int top = kolejka.front();
      kolejka.pop();
      koszt[top][t] = min(koszt[top][t], odl[top]);
      for (int i = 0; i < (((int)(graf[top]).size())); ++i) {
        if (odl[graf[top][i]] == 2000000011) {
          odl[graf[top][i]] = odl[top] + 1;
          kolejka.push(graf[top][i]);
        }
      }
    }
  }
  priority_queue<int> bufor;
  for (int i = 1; i <= (n); i++) {
    int suma = 0, c = 0;
    for (int t = 1; t <= (k); t++) bufor.push(-koszt[i][t]);
    while (!bufor.empty()) {
      if (c < s) suma += -bufor.top();
      c++;
      bufor.pop();
    }
    cout << suma << " ";
  }
  return 0;
}
