#include <bits/stdc++.h>
using namespace std;
const long maxn = 1e5 + 5;
const double minv = 1e-6;
const long inf = 1e9;
const long long mod = 1e9 + 7;
long a[maxn], q[maxn], len[maxn][101];
bool vis[maxn];
struct node {
  long d;
  struct node *next;
} * edge[maxn], *p;
int main() {
  long n, m, k, s, x, y, head, tail, i, j, t;
  scanf("%ld%ld%ld%ld", &n, &m, &k, &s);
  for (i = 1; i <= n; i++) edge[i] = NULL;
  for (i = 1; i <= n; i++) scanf("%ld", &a[i]);
  for (i = 1; i <= m; i++) {
    scanf("%ld%ld", &x, &y);
    p = (struct node *)malloc(sizeof(struct node));
    p->d = y;
    p->next = edge[x];
    edge[x] = p;
    p = (struct node *)malloc(sizeof(struct node));
    p->d = x;
    p->next = edge[y];
    edge[y] = p;
  }
  for (i = 1; i <= k; i++) {
    for (j = 1; j <= n; j++) vis[j] = 0;
    head = 0;
    tail = 0;
    for (j = 1; j <= n; j++)
      if (a[j] == i) {
        vis[j] = 1;
        tail++;
        q[tail] = j;
        len[j][i] = 0;
      }
    while (head < tail) {
      head++;
      p = edge[q[head]];
      while (p) {
        if (!vis[p->d]) {
          vis[p->d] = 1;
          tail++;
          q[tail] = p->d;
          len[p->d][i] = len[q[head]][i] + 1;
        }
        p = p->next;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    sort(len[i] + 1, len[i] + k + 1);
    t = 0;
    for (j = 1; j <= s; j++) t += len[i][j];
    printf("%ld", t);
    if (i != n) printf(" ");
  }
  return 0;
}
