#include <bits/stdc++.h>
using namespace std;
const int maxn = 510;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
int n, m, b, mod;
int a[maxn];
int dp[555][555];
int main() {
  while (~scanf("%d%d%d%d", &n, &m, &b, &mod)) {
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m; ++j) {
        for (int k = a[i]; k <= b; ++k) {
          dp[j][k] = (dp[j][k] + dp[j - 1][k - a[i]]) % mod;
        }
      }
    }
    int ans = 0;
    for (int i = 0; i <= b; ++i) {
      ans = (ans + dp[m][i]) % mod;
    }
    cout << ans << endl;
  }
  return 0;
}
