#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int n, m, k, s;
int head[maxn], tot, dis[105][maxn];
vector<int> g[maxn];
struct Edge {
  int to, next;
} edge[maxn << 1];
void init() {
  tot = 0;
  memset(head, -1, sizeof head);
  memset(dis, -1, sizeof dis);
}
void addedge(int u, int v) {
  edge[tot].to = v;
  edge[tot].next = head[u];
  head[u] = tot++;
  edge[tot].to = u;
  edge[tot].next = head[v];
  head[v] = tot++;
}
void bfs(int st) {
  queue<int> q;
  while (!q.empty()) q.pop();
  for (int i = 0; i < g[st].size(); ++i) {
    dis[st][g[st][i]] = 0;
    q.push(g[st][i]);
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = head[u]; i != -1; i = edge[i].next) {
      int v = edge[i].to;
      if (dis[st][v] == -1) {
        dis[st][v] = dis[st][u] + 1;
        q.push(v);
      }
    }
  }
}
int main() {
  while (~scanf("%d%d%d%d", &n, &m, &k, &s)) {
    init();
    for (int i = 1; i <= n; ++i) {
      int a;
      scanf("%d", &a);
      g[a].push_back(i);
    }
    for (int i = 0; i < m; ++i) {
      int u, v;
      scanf("%d%d", &u, &v);
      addedge(u, v);
    }
    for (int i = 1; i <= k; ++i) {
      bfs(i);
    }
    int path[105];
    for (int i = 1; i <= n; ++i) {
      int res = 0;
      for (int j = 1; j <= k; ++j) {
        path[j] = dis[j][i];
      }
      sort(path + 1, path + k + 1);
      for (int j = 1; j <= s; ++j) {
        res += path[j];
      }
      if (i != n)
        printf("%d ", res);
      else
        printf("%d\n", res);
    }
  }
  return 0;
}
