#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
vector<int> e[N];
queue<int> q;
vector<int> flag;
int dis[111][N];
int ans[111];
int main() {
  int n, m, k, s;
  cin >> n >> m >> k >> s;
  int a[N];
  for (int i = (1); i < (n + 1); ++i) cin >> a[i];
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    e[u].push_back(v);
    e[v].push_back(u);
  }
  memset(dis, -1, sizeof(dis));
  for (int i = 1; i <= k; ++i) {
    while (!q.empty()) q.pop();
    for (int j = 1; j <= n; ++j)
      if (a[j] == i) q.push(j), dis[i][j] = 0;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      for (auto& v : e[u]) {
        if (dis[i][v] != -1) continue;
        dis[i][v] = dis[i][u] + 1;
        q.push(v);
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= k; ++j) {
      ans[j] = dis[j][i];
    }
    sort(ans + 1, ans + k + 1);
    int a = 0;
    for (int j = 1; j <= s; ++j) a += ans[j];
    cout << a << ' ';
  }
  return 0;
}
