#include <bits/stdc++.h>
using namespace std;
int n, m, k, s, a[100005], r[100005 << 3];
int head[100005], Next[100005 << 1], vet[100005 << 1], num;
int f[105][100005], F[100005], ans[105];
void add(int x, int y) {
  Next[++num] = head[x];
  head[x] = num;
  vet[num] = y;
}
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 = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  for (int I = 1; I <= k; I++) {
    int tou = 0, wei = 0;
    for (int j = 1; j <= n; j++) f[I][j] = 100005;
    for (int j = 1; j <= n; j++)
      if (a[j] == I) {
        r[++wei] = j;
        F[j] = 1;
        f[I][j] = 0;
      }
    while (tou < wei) {
      tou++;
      for (int i = head[r[tou]]; i; i = Next[i]) {
        if (f[I][vet[i]] > f[I][r[tou]] + 1) {
          f[I][vet[i]] = f[I][r[tou]] + 1;
          if (!F[vet[i]]) {
            F[vet[i]] = 1;
            r[++wei] = vet[i];
          }
        }
      }
      F[r[tou]] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      ans[j] = f[j][i];
    }
    sort(ans + 1, ans + k + 1);
    long long res = 0;
    for (int j = 1; j <= s; j++) res += ans[j];
    printf("%I64d", res);
    if (i == n)
      printf("\n");
    else
      printf(" ");
  }
}
