#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 500;
int a[N];
vector<int> edge[N];
queue<int> q;
int vis[N];
int dis[N][105];
int main() {
  int n, m, k, s;
  scanf("%d %d %d %d", &n, &m, &k, &s);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int u, v;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &u, &v);
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  for (int i = 1; i <= k; i++) {
    memset(vis, 0, sizeof vis);
    for (int j = 1; j <= n; j++) {
      if (a[j] == i) {
        dis[j][i] = 0;
        vis[j] = 1;
        q.push(j);
      }
    }
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      for (auto v : edge[u]) {
        if (!vis[v]) {
          dis[v][i] = dis[u][i] + 1;
          vis[v] = 1;
          q.push(v);
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    sort(dis[i] + 1, dis[i] + k + 1);
    int ans = 0;
    for (int j = 1; j <= s; j++) {
      ans += dis[i][j];
    }
    printf("%d ", ans);
  }
}
