#include <bits/stdc++.h>
using namespace std;
long long n, m, b, mod, a[509], dp[509][509], ans;
int main() {
  cin >> n >> m >> b >> mod;
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= m; j++) {
      for (int k = 0; k <= b - a[i]; k++) {
        dp[j][k + a[i]] = (dp[j - 1][k] + dp[j][k + a[i]]) % mod;
      }
    }
  }
  for (int i = 0; i <= b; i++) ans += dp[m][i], ans %= mod;
  cout << ans;
}
