#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, vector<T> &a) {
  os << "{";
  bool was = false;
  for (auto &x : a) {
    if (was) {
      os << ", ";
    }
    was = true;
    os << x;
  }
  os << "}";
  return os;
}
template <typename T>
inline void debug(const char *sdbg, T x) {
  cerr << "The value of " << sdbg << " is " << x << "\n";
};
template <typename T, typename... U>
inline void debug(const char *sdbg, T h, U... t) {
  cerr << "The value of ";
  while (*sdbg != ',') {
    cerr << *sdbg++;
  }
  cerr << " is " << h << "\n";
  debug(sdbg + 1, t...);
  cerr << "\n";
}
template <typename T>
T abs(T x) {
  if (x < 0) {
    return -x;
  } else {
    return x;
  }
}
template <typename T>
T sqr(T x) {
  return x * x;
};
template <typename T, typename U>
T binpow(T a, U b, T MOD) {
  if (!b) {
    return 1;
  }
  if (b % 2) {
    return (binpow(a, b - 1, MOD) * a) % MOD;
  } else {
    return sqr(binpow(a, b / 2, MOD)) % MOD;
  }
};
template <typename T>
T binsum(T a, T b, T MOD) {
  if (!b) {
    return 0;
  }
  if (b % 2) {
    return (binsum(a, b - 1, MOD) + a) % MOD;
  } else {
    return 2 * binsum(a, b / 2, MOD) % MOD;
  }
}
template <typename T>
int sign(T x) {
  if (x < 0) {
    return -1;
  } else if (x > 0) {
    return 1;
  } else {
    return 0;
  }
};
template <typename T>
T gcd(T a, T b) {
  if (a > b) {
    swap(a, b);
  }
  while (a) {
    b %= a;
    swap(a, b);
  }
  return b;
};
template <typename T>
bool uin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
};
template <typename T>
bool uax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
};
const int INF = int(1e5 + 55);
const int root = 0;
int n, m, s, k;
vector<vector<int>> g, dp;
vector<int> used;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> m >> k >> s;
  g.resize(n);
  used.resize(n, 0);
  dp.resize(n, vector<int>(k, INF));
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    --x;
    dp[i][x] = 0;
  }
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    --u;
    --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int c = 0; c < k; ++c) {
    queue<int> q;
    for (int v = 0; v < n; ++v) {
      if (dp[v][c] == 0) {
        q.push(v);
      }
    }
    while (!q.empty()) {
      int v = q.front();
      q.pop();
      for (auto u : g[v]) {
        if (dp[u][c] > dp[v][c] + 1) {
          dp[u][c] = dp[v][c] + 1;
          q.push(u);
        }
      }
    }
  }
  for (int v = 0; v < n; ++v) {
    int cnt = 0;
    sort((dp[v]).begin(), (dp[v]).end());
    for (int i = 0; i < s; ++i) {
      cnt += dp[v][i];
    }
    cout << cnt << " ";
  }
  return 0;
}
