#include <bits/stdc++.h>
using namespace std;
const long long oo = 1E18;
const long long maxc = 1e5 + 7;
long long n, m, k, s;
vector<long long> v[maxc];
vector<long long> adj[maxc];
long long d[105][100005];
void bfs(vector<long long> vec, long long* d) {
  queue<long long> q;
  fill(d + 1, d + n + 1, -1);
  for (long long i : vec) {
    q.push(i);
    d[i] = 0;
  }
  while (!q.empty()) {
    long long p = q.front();
    q.pop();
    for (long long i : adj[p]) {
      if (d[i] == -1) {
        d[i] = d[p] + 1;
        q.push(i);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k >> s;
  for (long long i = 1; i <= n; i++) {
    long long first;
    cin >> first;
    v[first].push_back(i);
  }
  for (long long i = 1; i <= m; i++) {
    long long a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (long long i = 1; i <= k; i++) {
    bfs(v[i], d[i]);
  }
  for (long long i = 1; i <= n; i++) {
    vector<long long> v1;
    for (long long j = 1; j <= k; j++) {
      v1.push_back(d[j][i]);
    }
    sort(v1.begin(), v1.end());
    cout << accumulate(v1.begin(), v1.begin() + s, 0) << " ";
    v1.clear();
  }
  cout << endl;
}
