#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int n1, long long int n2) {
  if (n2 != 0)
    return gcd(n2, n1 % n2);
  else
    return n1;
}
long long int power(long long int a, long long int b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long int x = power(a, b / 2);
  if (b & 1) {
    return a * x * x;
  }
  return x * x;
}
const int SIZE = 100005;
vector<int> v[SIZE];
int vis[SIZE];
int dx[4] = {0, 1, -1, 0};
int dy[4] = {1, 0, 0, -1};
int ans[SIZE][102];
vector<int> typ[102];
int main() {
  memset(ans, 0, sizeof(ans));
  memset(vis, 0, sizeof(vis));
  int n, m, k, s, x, y;
  cin >> n >> m >> k >> s;
  for (__typeof((n)) i = (1); i <= (n); i++) {
    cin >> x;
    typ[x].push_back(i);
  }
  for (__typeof((m)) i = (1); i <= (m); i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  int q[SIZE];
  int dist[n + 1];
  for (__typeof((k)) i = (1); i <= (k); i++) {
    for (__typeof((n)) j = (1); j <= (n); j++) dist[j] = INT_MAX;
    int top = 0;
    for (__typeof(((int)typ[i].size() - 1)) j = (0);
         j <= ((int)typ[i].size() - 1); j++) {
      dist[typ[i][j]] = 0;
      q[top++] = typ[i][j];
    }
    for (__typeof((top - 1)) j = (0); j <= (top - 1); j++) {
      int u = q[j];
      for (__typeof(((int)v[u].size() - 1)) l = (0);
           l <= ((int)v[u].size() - 1); l++) {
        if (dist[v[u][l]] <= dist[u] + 1) continue;
        dist[v[u][l]] = dist[u] + 1;
        q[top++] = v[u][l];
      }
    }
    for (__typeof((n)) j = (1); j <= (n); j++) {
      ans[j][i] = dist[j];
    }
  }
  for (__typeof((n)) i = (1); i <= (n); i++) {
    nth_element(ans[i] + 1, ans[i] + s + 1, ans[i] + k + 1);
    int second = 0;
    for (__typeof((s)) j = (1); j <= (s); j++) second += ans[i][j];
    cout << second << " ";
  }
  cout << "\n";
}
