#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long int t;     t = 1;     for (long long int _ = 0; _ < t; _++) {       long long int n, m, b, mod;       cin >> n >> m >> b >> mod;       vector<long long int> v(n + 1);       for (long long int i = 1; i <= n; i++) cin >> v[i];       long long int dp[2][m + 1][b + 1];       for (long long int i = 0; i <= 1; i++) {         for (long long int j = 0; j <= m; j++) {           for (long long int k = 0; k <= b; k++) dp[i][j][k] = 0;         }       }       dp[0][0][0] = 1;       for (long long int i = 1; i <= n; i++) {         for (long long int j = 0; j <= m; j++) {           for (long long int k = 0; k <= b; k++) {             if (k >= v[i] && j > 0)               dp[i % 2][j][k] =                   (dp[1 - (i % 2)][j][k] + dp[i % 2][j - 1][k - v[i]]) % mod;             else               dp[i % 2][j][k] = dp[1 - (i % 2)][j][k];           }         }       }       long long int ans = 0;       for (long long int k = 0; k <= b; k++) ans = (ans + dp[n % 2][m][k]) % mod;       cout << ans <<   n ;     }     return 0;   }   