#include <bits/stdc++.h>
using namespace std;
int n, m, k, s, a[100005], u, v;
std::vector<vector<int> > adj(100005);
bool visited[100005], flag[105];
int travel(int node) {
  std::queue<pair<int, int> > Q;
  Q.push(make_pair(node, 0));
  visited[node] = true;
  int cnt = s - 1, cost = 0, presentNode = node, presentCost = 0;
  memset(flag, false, sizeof(flag));
  flag[a[node]] = true;
  while (!Q.empty()) {
    presentNode = Q.front().first;
    presentCost = Q.front().second;
    Q.pop();
    visited[presentNode] = true;
    if (!flag[a[presentNode]]) {
      cnt--;
      cost += presentCost;
      flag[a[presentNode]] = true;
    }
    if (cnt == 0) break;
    for (int i = 0; i < adj[presentNode].size(); ++i) {
      if (!visited[adj[presentNode][i]])
        Q.push(make_pair(adj[presentNode][i], 1 + presentCost));
    }
  }
  return cost;
}
int main() {
  cin >> n >> m >> k >> s;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i) {
    memset(visited, false, sizeof(visited));
    cout << travel(i) << " ";
  }
  return 0;
}
