#include <bits/stdc++.h>
using namespace std;
long long n, m, k, S, now;
long long col[100005], dis[100005][105];
long long tot, head[100005], nx[200005], to[200005];
vector<long long> a[105];
long long read() {
  char aa = getchar();
  long long pp = 1, kk = 0;
  while (aa < '0' || aa > '9') {
    if (aa == '-') pp = -1;
    aa = getchar();
  }
  while (aa >= '0' && aa <= '9') {
    kk = kk * 10 + aa - '0';
    aa = getchar();
  }
  return kk * pp;
}
void write(long long z) {
  if (z < 0) {
    putchar('-');
    z = -z;
  }
  if (z >= 10) {
    write(z / 10);
  }
  putchar(z % 10 + '0');
}
void jia(long long aa, long long bb) {
  tot++;
  nx[tot] = head[aa];
  to[tot] = bb;
  head[aa] = tot;
  return;
}
void bfs() {
  queue<long long> q;
  long long L = a[now].size();
  for (long long i = 0; i < L; ++i) {
    dis[a[now][i]][now] = 0;
    q.push(a[now][i]);
  }
  while (!q.empty()) {
    long long kk = q.front();
    q.pop();
    for (long long i = head[kk]; i; i = nx[i]) {
      long long yy = to[i];
      if (dis[yy][now] > dis[kk][now] + 1) {
        dis[yy][now] = dis[kk][now] + 1;
        q.push(yy);
      }
    }
  }
  return;
}
int main() {
  memset(dis, 0x3f3f3f3f, sizeof(dis));
  n = read();
  m = read();
  k = read();
  S = read();
  for (long long i = 1; i <= n; ++i) {
    col[i] = read();
    a[col[i]].push_back(i);
  }
  for (long long i = 1; i <= m; ++i) {
    long long x = read(), y = read();
    jia(x, y);
    jia(y, x);
  }
  for (long long i = 1; i <= k; ++i) {
    now = i;
    bfs();
  }
  for (long long i = 1; i <= n; ++i) {
    sort(dis[i] + 1, dis[i] + k + 1);
    long long sum = 0;
    for (long long j = 1; j <= S; ++j) sum += dis[i][j];
    write(sum);
    putchar(' ');
  }
  return 0;
}
