#include <bits/stdc++.h>
using namespace std;
int arr[100005][110];
void bfs(vector<int> vec[], int type[], int k, int n) {
  queue<int> q;
  for (int i = 0; i < n; i++) {
    if (type[i] == k) {
      q.push(i);
      arr[i][k] = 0;
    }
  }
  while (!q.empty()) {
    int t = q.front(), x;
    q.pop();
    for (int i = 0; i < vec[t].size(); i++) {
      x = vec[t][i];
      if (arr[x][k] > (arr[t][k] + 1)) {
        q.push(x);
        arr[x][k] = arr[t][k] + 1;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int t, n, m, k, s;
  scanf("%d%d%d%d", &n, &m, &k, &s);
  int type[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &type[i]);
  }
  vector<int> vec[n];
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d", &u);
    scanf("%d", &v);
    u--, v--;
    vec[u].push_back(v);
    vec[v].push_back(u);
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < k + 1; j++) arr[i][j] = INT_MAX;
  for (int i = 0; i < k; i++) {
    bfs(vec, type, i + 1, n);
  }
  vector<int> ans(n, 0);
  for (int i = 0; i < n; i++) {
    nth_element(arr[i] + 1, arr[i] + s + 1, arr[i] + k + 1);
    for (int h = 1; h <= s; h++) ans[i] += arr[i][h];
  }
  for (int i = 0; i < n; i++) printf("%d ", ans[i]);
  return 0;
}
