#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 5;
int n, m, k, s;
int a[maxn];
int vis[maxn];
int dis[maxn][105];
vector<int> vec[maxn];
void bfs(int kin) {
  memset(vis, 0, sizeof(vis));
  queue<int> q;
  for (int i = 1; i <= n; i++) {
    if (a[i] == kin) {
      q.push(i);
      vis[i] = 1;
      dis[i][kin] = 0;
    }
  }
  while (!q.empty()) {
    int tt = q.front();
    q.pop();
    for (int i = 0; i < vec[tt].size(); i++) {
      int v = vec[tt][i];
      if (vis[v])
        continue;
      else {
        vis[v] = 1;
        dis[v][kin] = dis[tt][kin] + 1;
        q.push(vec[tt][i]);
      }
    }
  }
}
int main() {
  memset(dis, 0x3f, sizeof(dis));
  cin >> n >> m >> k >> s;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  while (m--) {
    int u, v;
    scanf("%d%d", &u, &v);
    vec[u].push_back(v);
    vec[v].push_back(u);
  }
  for (int i = 1; i <= k; i++) bfs(i);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = 0;
    sort(dis[i] + 1, dis[i] + 1 + k);
    for (int j = 1; j <= s; j++) {
      ans += dis[i][j];
    }
    if (i != n)
      printf("%d ", ans);
    else
      printf("%d\n", ans);
  }
  return 0;
}
