#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e5;
vector<int> v[MaxN + 5];
vector<int> G[MaxN + 5];
vector<int> res[MaxN + 5];
int n, m, K, s;
int ans[MaxN + 5];
int seq[MaxN + 5];
int dis[MaxN + 5];
bool vis[MaxN + 5];
int main() {
  while (~scanf("%d%d%d%d", &n, &m, &K, &s)) {
    int x;
    for (int i = 1; i <= n; i++) scanf("%d", &x), v[x].push_back(i);
    for (int i = 1; i <= m; i++) {
      int u, v;
      scanf("%d%d", &u, &v);
      G[u].push_back(v);
      G[v].push_back(u);
    }
    for (int c = 1; c <= K; c++) {
      for (int i = 1; i <= n; i++) vis[i] = false, dis[i] = 1 << 30;
      int head = 1, tail = 0;
      for (int i = 0; i < (int)v[c].size(); i++) {
        dis[v[c][i]] = 0;
        seq[++tail] = v[c][i];
        vis[v[c][i]] = true;
      }
      while (head <= tail) {
        int now = seq[head];
        for (int i = 0; i < (int)G[now].size(); i++) {
          if (!vis[G[now][i]]) {
            vis[G[now][i]] = true;
            dis[G[now][i]] = dis[now] + 1;
            seq[++tail] = G[now][i];
          }
        }
        head++;
      }
      for (int i = 1; i <= n; i++) res[i].push_back(dis[i]);
    }
    for (int i = 1; i <= n; i++) sort(res[i].begin(), res[i].end());
    for (int i = 1; i <= n; i++) {
      ans[i] = 0;
      for (int j = 0; j < s; j++) ans[i] += res[i][j];
      printf("%d ", ans[i]);
    }
    printf("\n");
  }
  return 0;
}
