#include <bits/stdc++.h>
int n, m, b, mod, a, dp[507][507] = {1};
int main() {
  std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
  std::cin >> n >> m >> b >> mod;
  for (int i = 0; i < n; ++i) {
    std::cin >> a;
    for (int j = 1; j <= m; ++j)
      for (int k = b; k >= a; --k)
        dp[j][k] = (dp[j][k] + dp[j - 1][k - a]) % mod;
  }
  int res = 0;
  for (int i = 0; i <= b; ++i) res = (res + dp[m][i]) % mod;
  std::cout << res << "\n";
  return 0;
}
