#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
const int K = 101;
int visited[N];
int temp[N][K];
vector<int> graph[N];
int ret[N];
int arr[N];
void bfs(int a, int n) {
  queue<int> q;
  for (int i = 1; i <= n; i++) {
    if (arr[i] == a) {
      q.push(i);
      visited[i] = 1;
    }
  }
  while (!q.empty()) {
    int z = q.front();
    q.pop();
    for (int i = 0; i < graph[z].size(); i++) {
      if (visited[graph[z][i]] == 0) {
        visited[graph[z][i]] = 1;
        ret[graph[z][i]] = ret[z] + 1;
        q.push(graph[z][i]);
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    temp[i][a] = ret[i];
    ret[i] = 0;
    visited[i] = 0;
  }
}
int main() {
  int n, m, k, s;
  cin >> n >> m >> k >> s;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  for (int i = 1; i <= k; i++) bfs(i, n);
  for (int i = 1; i <= n; i++) {
    int sum = 0;
    sort(temp[i] + 1, temp[i] + k + 1);
    for (int j = 1; j <= s; j++) sum += temp[i][j];
    cout << sum << " ";
  }
  cout << endl;
  return 0;
}
