#include <bits/stdc++.h>
using namespace std;
int ans[100003][102];
int main() {
  int n, m, s, k, i, j, arr[100003], u, v, vis[100003];
  memset(ans, -1, sizeof(ans));
  vector<int> vec[100003];
  queue<pair<int, int> > q;
  scanf("%d %d %d %d", &n, &m, &k, &s);
  for (i = 1; i <= n; ++i) scanf("%d", &arr[i]);
  for (i = 0; i < m; ++i) {
    scanf("%d %d", &u, &v);
    vec[u].push_back(v);
    vec[v].push_back(u);
  }
  for (i = 1; i <= k; ++i) {
    for (j = 1; j <= n; ++j) {
      if (arr[j] == i) q.push(make_pair(j, 0));
    }
    while (!q.empty()) {
      u = (q.front()).first;
      v = (q.front()).second;
      q.pop();
      if (ans[u][i] != -1) continue;
      ans[u][i] = v;
      for (j = 0; j < vec[u].size(); ++j) {
        if (ans[vec[u][j]][i] == -1)
          q.push(make_pair(vec[u][j], ans[u][i] + 1));
      }
    }
  }
  for (i = 1; i <= n; ++i) {
    u = 0;
    sort(ans[i] + 1, ans[i] + k + 1);
    for (j = 1; j <= s; ++j) u += ans[i][j];
    printf("%d ", u);
  }
  return 0;
}
