#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
struct node {
  int x, d;
};
vector<int> adj[100005];
vector<int> good[105];
int vis[100005];
int a[100005];
int d[100005][105];
void bfs(int s) {
  queue<node> q;
  for (int i = 0; i < good[s].size(); i++) {
    int v = good[s][i];
    node tmp;
    tmp.x = v;
    tmp.d = 0;
    q.push(tmp);
  }
  while (!q.empty()) {
    node t = q.front();
    q.pop();
    d[t.x][s] = min(d[t.x][s], t.d);
    for (int i = 0; i < adj[t.x].size(); i++) {
      int v = adj[t.x][i];
      if (vis[v] == 0) {
        vis[v] = 1;
        node tmp;
        tmp.x = v;
        tmp.d = t.d + 1;
        q.push(tmp);
      }
    }
  }
}
int main() {
  int n, m, k, s, u, v;
  scanf("%d%d%d%d", &n, &m, &k, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    good[a[i]].push_back(i);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  fill(d[0], d[0] + 105 * 100005, inf);
  for (int i = 1; i <= k; i++) {
    memset(vis, 0, sizeof(vis));
    bfs(i);
  }
  for (int i = 1; i <= n; i++) {
    sort(d[i] + 1, d[i] + 1 + k);
    long long sum = 0;
    for (int j = 1; j <= s; j++) sum += d[i][j];
    printf("%lld ", sum);
  }
  return 0;
}
