#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int N = 1e5 + 5;
const int K = 110;
vector<int> g[N];
vector<int> rec[N];
int n, m, k, s, u, v;
int a[N];
int vis[N], dist[N], kase;
queue<int> color[K];
void fill(int c) {
  for (int i = 1; i <= n; i++) dist[i] = INF;
  queue<int> q = color[c];
  int sz = q.size();
  while (sz--) {
    dist[q.front()] = 0;
    q.push(q.front());
    q.pop();
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v : g[u]) {
      if (dist[v] > dist[u] + 1) {
        dist[v] = dist[u] + 1;
        if (rec[v][c] > dist[v]) {
          q.push(v);
          rec[v][c] = dist[v];
        }
      }
    }
  }
}
int main() {
  scanf("%d %d %d %d", &n, &m, &k, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    rec[i].resize(k + 1);
    for (int j = 1; j <= k; j++) rec[i][j] = INF;
    color[a[i]].push(i);
    rec[i][a[i]] = 0;
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= k; i++) fill(i);
  for (int i = 1; i <= n; i++) {
    vector<int> rc;
    for (int j = 1; j <= k; j++) {
      rc.push_back(rec[i][j]);
    }
    sort(rc.begin(), rc.end());
    int ans = 0;
    for (int j = 0; j < s; j++) ans += rc[j];
    printf("%d ", ans);
  }
  return 0;
}
