#include <bits/stdc++.h>   using namespace std;   template <typename Container>   void print(Container& container) {     auto Start = container.begin(), End = container.end();     while (Start != End) cout << *(Start++) <<    ;     cout <<   n ;   }   const int N = 5e2 + 1;   int dp[2][N][N], a[N];   inline void solve() {     int n, m, b, mod;     cin >> n >> m >> b >> mod;     for (int i = 1; i <= n; ++i) cin >> a[i];     dp[0][0][0] = 1;     for (int i = 1; i <= n; ++i) {       for (int j = 0; j <= m; ++j) {         for (int k = 0; k <= b; ++k) {           dp[i & 1][j][k] = dp[i & 1 ^ 1][j][k];           if (j && k >= a[i]) dp[i & 1][j][k] += dp[i & 1][j - 1][k - a[i]];           dp[i & 1][j][k] %= mod;         }       }     }     int ans = 0;     for (int k = 0; k <= b; ++k) ans = (ans + dp[n & 1][m][k]) % mod;     cout << ans <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     int T = 1;     while (T--) solve();   }   