#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
const int MAXK = 1e2 + 10;
const int INF = 1e9 + 10;
vector<int> vertex[MAXN];
vector<int> e[MAXK];
queue<int> q;
int w[MAXN][MAXK];
int dist[MAXK][MAXN];
void bfs(int x) {
  fill(dist[x], dist[x] + MAXN, INF);
  for (int i = 0; i < e[x].size(); i++) {
    dist[x][e[x][i]] = 0;
    q.push(e[x][i]);
  }
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int i = 0; i < vertex[v].size(); i++) {
      if (dist[x][vertex[v][i]] == INF) {
        w[vertex[v][i]][x] = dist[x][v] + 1;
        dist[x][vertex[v][i]] = dist[x][v] + 1;
        q.push(vertex[v][i]);
      }
    }
  }
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  int n, m, k, s;
  cin >> n >> m >> k >> s;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    e[x].push_back(i);
  }
  for (int i = 0; i < m; i++) {
    int v, u;
    cin >> v >> u;
    vertex[v].push_back(u);
    vertex[u].push_back(v);
  }
  for (int i = 1; i <= k; i++) {
    bfs(i);
  }
  for (int i = 1; i <= n; i++) {
    sort(w[i] + 1, w[i] + k + 1);
    int res = 0;
    for (int j = 1; j <= s; j++) {
      res += w[i][j];
    }
    cout << res << " ";
  }
}
