#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int MOD = 1000000007;
const int UNDEF = -1;
const int INF = 1 << 30;
template <typename T>
inline bool chkmax(T &aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T &aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
int rint();
char rch();
long long rlong();
const int mn = 1e5 + 4;
vector<int> g[mn];
int a[mn];
int vdist[mn];
vector<int> vans[mn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n = rint(), m = rint(), k = rint(), s = rint();
  for (int i = 1; i <= n; i++) a[i] = rint();
  for (int i = 0; i < m; i++) {
    int x = rint(), y = rint();
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (int t = 1; t <= k; t++) {
    queue<int> q;
    memset(vdist, 0x7f, sizeof vdist);
    for (int x = 1; x <= n; x++)
      if (a[x] == t) {
        q.push(x);
        vdist[x] = 0;
      }
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      int d = vdist[x] + 1;
      for (auto &y : g[x]) {
        if (vdist[y] > d) {
          vdist[y] = d;
          q.push(y);
        }
      }
    }
    for (int x = 1; x <= n; x++) vans[x].push_back(vdist[x]);
  }
  for (int x = 1; x <= n; x++) {
    sort(vans[x].begin(), vans[x].end());
    long long ans = 0;
    for (int i = 0; i < s; i++) ans += vans[x][i];
    printf("%lld ", ans);
  }
  printf("\n");
}
static char stdinBuffer[1024];
static char *stdinDataEnd = stdinBuffer + sizeof(stdinBuffer);
static const char *stdinPos = stdinDataEnd;
void readAhead(size_t amount) {
  size_t remaining = stdinDataEnd - stdinPos;
  if (remaining < amount) {
    memmove(stdinBuffer, stdinPos, remaining);
    size_t sz = fread(stdinBuffer + remaining, 1,
                      sizeof(stdinBuffer) - remaining, stdin);
    stdinPos = stdinBuffer;
    stdinDataEnd = stdinBuffer + remaining + sz;
    if (stdinDataEnd != stdinBuffer + sizeof(stdinBuffer)) *stdinDataEnd = 0;
  }
}
int rint() {
  readAhead(16);
  int x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}
char rch() {
  readAhead(16);
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  char ans = *stdinPos;
  ++stdinPos;
  return ans;
}
long long rlong() {
  readAhead(32);
  long long x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}
