#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
vector<long long> g1[200], g2[100001], g[100001];
int main() {
  long long n, m, k, s;
  cin >> n >> m >> k >> s;
  long long a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    g2[x].push_back(y);
    g2[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    g1[a[i]].push_back(i);
  }
  for (int i = 1; i <= k; i++) {
    queue<long long> q;
    bool visited[100001] = {0};
    for (int j = 0; j < g1[i].size(); j++) {
      dp[i][g1[i][j]] = 0;
      visited[g1[i][j]] = 1;
      q.push(g1[i][j]);
    }
    while (!q.empty()) {
      long long x = q.front();
      q.pop();
      visited[x] = true;
      for (int j = 0; j < g2[x].size(); j++) {
        if (visited[g2[x][j]] == false) {
          visited[g2[x][j]] = true;
          dp[i][g2[x][j]] = dp[i][x] + 1;
          q.push(g2[x][j]);
        }
      }
    }
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      g[j].push_back(dp[i][j]);
    }
  }
  for (int i = 1; i <= n; i++) {
    sort(g[i].begin(), g[i].end());
  }
  for (int i = 1; i <= n; i++) {
    long long ans = 0;
    for (int j = 0; j < s; j++) {
      ans = ans + g[i][j];
    }
    cout << ans << " ";
  }
  return 0;
}
