#include <bits/stdc++.h>
using namespace std;
int n, m, k, s, v1, v2;
int ans[101][100005];
vector<int> g[100005];
int q[100005];
int a[100005];
bool used[100005];
void bfs(int k) {
  int head = 0, tail = 1, v, to;
  for (int i = 1; i <= n; i++) {
    used[i] = 0;
    if (a[i] == k) {
      q[++tail] = i;
      used[i] = 1;
    }
  }
  while (head < tail) {
    v = q[++head];
    for (int i = 0; i < g[v].size(); i++) {
      to = g[v][i];
      if (!used[to]) {
        used[to] = 1;
        ans[k][to] = ans[k][v] + 1;
        q[++tail] = to;
      }
    }
  }
}
int mins[101];
int main() {
  scanf("%d%d%d%d", &n, &m, &k, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &v1, &v2);
    g[v1].push_back(v2);
    g[v2].push_back(v1);
  }
  for (int i = 1; i <= k; i++) {
    bfs(i);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      mins[j] = ans[j][i];
    }
    sort(mins + 1, mins + k + 1);
    int sum = 0;
    for (int i = 1; i <= s; i++) {
      sum += mins[i];
    }
    printf("%d ", sum);
  }
  return 0;
}
