#include<fstream>
#include<algorithm>
#include <iostream>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include <stack>
#include <queue>
#include <vector>
#include <iterator>
#include <math.h>
#include<cstring>
#include <cmath>
#include <set>
#include <cmath>
#define lp(i,n) for(int i=0;i<(int)n;i++)
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define clr(v, d) memset(v, d, sizeof(v))
#define rep(i, v) for(int i=0;i<sz(v);++i)
using namespace std;
#define vi vector<int>
#define vd vector<double>
#define fast std::ios_base::sync_with_stdio(false);
#define LL long long
int N,M,B,MOD;
int MAXN = 501;
LL memo[501][501];
LL dp[501][501][501];
int arr[501];
int main(){
cin >> N >> M >>B >> MOD;
for(int i=1;i<=N;i++)cin >> arr[i];
clr(memo,-1);
clr(dp,0);
dp[0][0][0] = 1;
lp(i,N+1) dp[i][0][0] = 1;
for(int i=1;i<=N;i++){
for(int j=1;j<=M;j++){
for(int k=0;k<=B;k++){
dp[i][j][k] += dp[(i-1)][j][k]%MOD;
if(k-arr[i]>=0) dp[(i)][j][k] += (dp[(i)][j-1][k-arr[i]])%MOD;
}
}
}
LL sum = 0;
lp(i,B+1){
sum += (dp[N][M][i]+MOD)%MOD;
}
cout << sum << endl;
}
I2luY2x1ZGU8ZnN0cmVhbT4KI2luY2x1ZGU8YWxnb3JpdGhtPgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlPG51bWVyaWM+CiNpbmNsdWRlPHV0aWxpdHk+CiNpbmNsdWRlPGZ1bmN0aW9uYWw+CiNpbmNsdWRlPHN0ZGlvLmg+CiNpbmNsdWRlPGFzc2VydC5oPgojaW5jbHVkZTxtZW1vcnkuaD4KI2luY2x1ZGU8Yml0c2V0PgojaW5jbHVkZSA8c3RhY2s+CiNpbmNsdWRlIDxxdWV1ZT4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGl0ZXJhdG9yPgojaW5jbH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