#include <bits/stdc++.h>
using namespace std;
vector<long long> g[100010];
long long arr[100010];
long long n, m, k, s, u, v;
long long res[100001][101];
void cal(int t) {
  queue<int> Q;
  for (int i = 1; i <= n; i++) {
    if (arr[i] == t) {
      res[i][t] = 0;
      Q.push(i);
    }
  }
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    int s = g[u].size();
    for (int i = 0; i < s; i++) {
      int v = g[u][i];
      if (res[v][t] > res[u][t] + 1) {
        res[v][t] = res[u][t] + 1;
        Q.push(v);
      }
    }
  }
}
int main() {
  for (int i = 0; i <= 100000; i++) {
    for (int j = 0; j <= 100; j++) res[i][j] = 100000000;
  }
  cin >> n >> m >> k >> s;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &arr[i]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%lld %lld", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= k; i++) {
    cal(i);
  }
  for (int i = 1; i <= n; i++) {
    sort(res[i], res[i] + k + 1);
    long long sum = 0;
    for (int j = 0; j < s; j++) {
      sum += res[i][j];
    }
    printf("%lld ", sum);
  }
  printf("\n");
  return 0;
}
