#include <bits/stdc++.h>
using namespace std;
int a[100500];
vector<int> gr[100500];
int n, m, s, k;
int res[100500][101];
int d[100500];
int q[100500];
int A[100500];
int B[100500];
int sz[100500];
int main() {
  scanf("%d %d %d %d", &n, &m, &k, &s);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    int u = n + a[i];
    gr[u].push_back(i);
  }
  for (int i = 0; i < m; i++) {
    int c, b;
    scanf("%d %d", &c, &b);
    A[i] = c;
    B[i] = b;
    sz[c]++;
    sz[b]++;
  }
  for (int i = 1; i <= n; i++) gr[i].resize(sz[i]);
  for (int i = 0; i < m; i++) {
    gr[A[i]][--sz[A[i]]] = B[i];
    gr[B[i]][--sz[B[i]]] = A[i];
  }
  for (int i = 1; i <= k; ++i) {
    int ql = 0, qr = 0;
    for (int j = 1; j <= n; ++j) {
      if (a[j] != i)
        d[j] = 1e9;
      else {
        d[j] = 0;
        q[qr++] = j;
      }
    }
    while (ql <= qr) {
      auto x = q[ql++];
      res[x][i - 1] = d[x];
      for (auto v : gr[x]) {
        if (d[v] >= 1e9) {
          d[v] = 1 + d[x];
          q[qr++] = v;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    sort(res[i], res[i] + k);
    int w = 0;
    for (int j = 0; j < s; ++j) {
      w += res[i][j];
    }
    cout << w << ' ';
  }
  return 0;
}
