import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public class P {

	static int N, M, B, MOD;
	static int[][][] dp;
	static int[] a;

	static int solve(int cur, int remL, int remB) {
		if (remL <= 0 && remB >= 0)
			return 1;

		if (cur == N || remB < 0)
			return 0;

		if (dp[cur][remL][remB] != -1)
			return dp[cur][remL][remB];

		int ret = 0;
		for (int i = 0; i <= remL && i * a[cur] <= remB; ++i)
			ret = (ret % MOD + solve(cur + 1, (remL - i), remB - (i * a[cur])) % MOD) % MOD;
		return dp[cur][remL][remB] = ret;
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		M = sc.nextInt();
		B = sc.nextInt();
		MOD = sc.nextInt();
		int[] b = sc.nextIntArraySorted(N);
		a = new int[N];
		for (int i = 0; i < N; i++)
			a[i] = b[N - i - 1];
		dp = new int[N + 1][M + 1][B + 1];
		for (int i = 0; i <= N; i++)
			for (int j = 0; j <= M; j++)
				Arrays.fill(dp[i][j], -1);
		System.out.println(solve(0, M, B) % MOD);
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String f) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(f));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public int[] nextIntArray1(int n) throws IOException {
			int[] a = new int[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextInt();
			return a;
		}

		public int[] shuffle(int[] a, int n) {
			int[] b = new int[n];
			for (int i = 0; i < n; i++)
				b[i] = a[i];
			Random r = new Random();
			for (int i = 0; i < n; i++) {
				int j = i + r.nextInt(n - i);
				int t = b[i];
				b[i] = b[j];
				b[j] = t;
			}
			return b;
		}

		public int[] nextIntArraySorted(int n) throws IOException {
			int[] a = nextIntArray(n);
			a = shuffle(a, n);
			Arrays.sort(a);
			return a;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public long[] nextLongArray1(int n) throws IOException {
			long[] a = new long[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextLong();
			return a;
		}

		public long[] nextLongArraySorted(int n) throws IOException {
			long[] a = nextLongArray(n);
			Random r = new Random();
			for (int i = 0; i < n; i++) {
				int j = i + r.nextInt(n - i);
				long t = a[i];
				a[i] = a[j];
				a[j] = t;
			}
			Arrays.sort(a);
			return a;
		}
	}
}


import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintStream;
import java.util.Scanner;
import java.util.stream.Stream;

/**
 * Created by Bakytzhan_Manaspayev on 9/13/2016.
 */
public class WritingCode {
    PrintStream out = new PrintStream(new BufferedOutputStream(System.out));
    Scanner in = new Scanner(new BufferedInputStream(System.in));

    public static void main(String[] args) {
        WritingCode w = new WritingCode();
        w.solve();
        w.out.flush();
    }

    void solve() {
        //n, m, b, mod
        int n = in.nextInt();
        int m = in.nextInt();
        int b = in.nextInt();
        int mod = in.nextInt();

        in.nextLine(); // go next line

        int[] bugs = Stream.of(in.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        int dp[][] = new int[m + 1][b + 1];

        dp[0][0] = 1;

        for (int i = 0; i < n; i++) {
            for (int l = 0; l < m; l++) {
                for (int bg = 0; bg + bugs[i] <= b; bg++) {
                    int dp1 = dp[l][bg];
                    int dp2 = dp[l + 1][bg + bugs[i]];
                    dp[l + 1][bg + bugs[i]] = (dp1 + dp2) % mod;
                }
            }
        }

        int result = 0;
        for (int i = 0; i <= b; i++) {
            result = (result + dp[m][i]) % mod;
        }

        out.println(result);

    }
}


import java.util.Scanner;

/**
 * Created by Bakytzhan_Manaspayev on 9/7/2016.
 */
public class Understand {
    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        /**
         Давайте для начала придумаем решение который будет работать медленнее чем нужно.
         Будем решать задачи динамическим программированием: z[i][j][k] — мы обработали ровно i программистов, написали ровно j строчек кода и при этом возникло ровно k ошибок.
         Как сделать в такой динамике переходы? Очень просто, переберём сколько строчек напишет i программист (пусть r) и прибавим к z[i][j][k] значение z[i][j-r][k-r[ai]].
         Однако давайте посмотрим на переходы с другой стороны.
         Очевидно, что i программист либо не напишет ни одной строчки, тогда к ответу прибавится значение z[i-1][j][k], либо он напишет одну строчку,
         а остальные строчки учтутся в значении z[i][j-1][k-a[i]]. Здесь можно провести аналогию c подсчетом биномиальных коэффициентов c помощью треугольника паскаля.
         Таким образом получим решение за ассимптотику O(n3)
         */

        /**
        as we know that current programmer can only impact count of previous programmer
        so basically we can store two instances, we can store previous instance and
        then the current instance.
        If you do not use two instances, you cannot differ between current and previous instance
        more details below
        **/
        int n = in.nextInt(), bl = in.nextInt(), bugs = in.nextInt(), md = in.nextInt();
        int z[][][] = new int[2][bl+1][bugs+1];
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        /**
         we can conclude that we can write 0 line with 0 bugs in 1 way.
         that way is not to write anything.
         */
        z[0][0][0] = 1;
        for (int it = 1; it <= n; it++) {
            /**
            i will store which instance are we in
            if 'it' is odd then i is 1 else i is 0
            */
            int i = it & 1;
            for (int j = 0; j <= bl; j++) {
                for (int k = 0; k <= bugs; k++) {
                    /**
                    j is the count of lines written and k is the count of bugs
                    first we make current instance value equal to previous instance
                    i^1 (xor) will give us 0 if i is 1, otherwise 1 if i is 0. basically
                    i^1 gives the same result like (!i), if i can be 0 or 1.
                    */
                    z[i][j][k] = z[i ^ 1][j][k];
                    /**
                    now we check that if j > 0 and bugs k is more or equal than
                    the bugs(a[it-1]) possible  by current programmer.
                    if k < a[it-1] then k - a[it-1] < 0, which is not possible
                    */
                    if (j > 0 && k >= a[it - 1]) {
                        z[i][j][k] += z[i][j - 1][k - a[it - 1]];
                        /**
                        if you are asking yourself but why are we only subtracting
                        this programmers a[i] for the current instance, then think like this
                        if the current programmer changed the count of (j-1, k-a[i]) in the current
                        instance then that new value should be added here else the value from previous
                        instance should be added. This is because we are making
                        current [j-1][k-a[i]] equal to previous [j-1][k-a[i]]
                        at this line: z[i][j][k] = z[i ^ 1][j][k];
                         */
                    }
                    /// here we take care of the mod
                    while (z[i][j][k] >= md)
                        z[i][j][k] -= md;
                }
            }
        }
        int ans = 0;
        for (int i = 0; i <= bugs; i++) {
            /**
            now we add all the values for the last programmer's instance
            Note that stage(bl, i) means that some how we were able to have written all
            'bl' lines with bugs = i in total.
            so [bl][0] means all 'bl' lines were written with no bug in any line. this is only
            possible if atleast one programmer can write a line of code with 0 error and
            if he writes all the lines 'bl', then he will never add any error;
            also we need to add the value of the instance written by the nth (last) programmer
             */
            ans += z[n & 1][bl][i];
            /** taking care of the mod*/
            while (ans >= md) ans -= md;
        }
        System.out.println(ans);
    }
}


import java.util.Scanner;

/**
 * Created by Bakytzhan_Manaspayev on 9/7/2016.
 */
public class Understand {
    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        /**
         Давайте для начала придумаем решение который будет работать медленнее чем нужно.
         Будем решать задачи динамическим программированием: z[i][j][k] — мы обработали ровно i программистов, написали ровно j строчек кода и при этом возникло ровно k ошибок.
         Как сделать в такой динамике переходы? Очень просто, переберём сколько строчек напишет i программист (пусть r) и прибавим к z[i][j][k] значение z[i][j-r][k-r[ai]].
         Однако давайте посмотрим на переходы с другой стороны.
         Очевидно, что i программист либо не напишет ни одной строчки, тогда к ответу прибавится значение z[i-1][j][k], либо он напишет одну строчку,
         а остальные строчки учтутся в значении z[i][j-1][k-a[i]]. Здесь можно провести аналогию c подсчетом биномиальных коэффициентов c помощью треугольника паскаля.
         Таким образом получим решение за ассимптотику O(n3)
         */

        /**
        as we know that current programmer can only impact count of previous programmer
        so basically we can store two instances, we can store previous instance and
        then the current instance.
        If you do not use two instances, you cannot differ between current and previous instance
        more details below
        **/
        int n = in.nextInt(), bl = in.nextInt(), bugs = in.nextInt(), md = in.nextInt();
        int z[][][] = new int[2][bl+1][bugs+1];
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        /**
         we can conclude that we can write 0 line with 0 bugs in 1 way.
         that way is not to write anything.
         */
        z[0][0][0] = 1;
        for (int it = 1; it <= n; it++) {
            /**
            i will store which instance are we in
            if 'it' is odd then i is 1 else i is 0
            */
            int i = it & 1;
            for (int j = 0; j <= bl; j++) {
                for (int k = 0; k <= bugs; k++) {
                    /**
                    j is the count of lines written and k is the count of bugs
                    first we make current instance value equal to previous instance
                    i^1 (xor) will give us 0 if i is 1, otherwise 1 if i is 0. basically
                    i^1 gives the same result like (!i), if i can be 0 or 1.
                    */
                    z[i][j][k] = z[i ^ 1][j][k];
                    /**
                    now we check that if j > 0 and bugs k is more or equal than
                    the bugs(a[it-1]) possible  by current programmer.
                    if k < a[it-1] then k - a[it-1] < 0, which is not possible
                    */
                    if (j > 0 && k >= a[it - 1]) {
                        z[i][j][k] += z[i][j - 1][k - a[it - 1]];
                        /**
                        if you are asking yourself but why are we only subtracting
                        this programmers a[i] for the current instance, then think like this
                        if the current programmer changed the count of (j-1, k-a[i]) in the current
                        instance then that new value should be added here else the value from previous
                        instance should be added. This is because we are making
                        current [j-1][k-a[i]] equal to previous [j-1][k-a[i]]
                        at this line: z[i][j][k] = z[i ^ 1][j][k];
                         */
                    }
                    /// here we take care of the mod
                    z[i][j][k]=z[i][j][k]%md;
                }
            }
        }
        int ans = 0;
        for (int i = 0; i <= bugs; i++) {
            /**
            now we add all the values for the last programmer's instance
            Note that stage(bl, i) means that some how we were able to have written all
            'bl' lines with bugs = i in total.
            so [bl][0] means all 'bl' lines were written with no bug in any line. this is only
            possible if atleast one programmer can write a line of code with 0 error and
            if he writes all the lines 'bl', then he will never add any error;
            also we need to add the value of the instance written by the nth (last) programmer
             */
            ans += z[n & 1][bl][i];
            /** taking care of the mod*/
            ans=ans%md;
        }
        System.out.println(ans);
    }
}


import java.io.*;
import java.util.*;

public class A {

    private static long modulo = 1000000007;

    private static void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int b = in.nextInt();
        modulo = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        long[][] dp = new long[m + 1][b + 1];
        dp[0][0] = 1;
        for (int i = 0; i < n; i++) {
            for (int v = 0; v < m; v++) {
                for (int j = 0; j <= b; j++) {
                    if (j + a[i] <= b) {
                        dp[v + 1][j + a[i]] += dp[v][j];
                        if (dp[v + 1][j + a[i]] >= modulo) {
                            dp[v + 1][j + a[i]] -= modulo;
                        }
                    }
                }
            }
        }
        long result = 0;
        for (int j = 0; j <= b; j++) {
            result += dp[m][j];
            if (result >= modulo) {
                result -= modulo;
            }
        }
        out.println(result);
    }

    private static long inverse(long a) {
        long result = 1;
        int n = (int) modulo - 2;
        while (n != 0) {
            if ((n & 1) == 1)
                result = (result * a) % modulo;
            a = (a * a) % modulo;
            n >>= 1;
        }
        return result;
    }

    private static long pow(long a, long n) {
        if (n == 0) return 1;
        if (n % 2 == 0) {
            long ans = pow(a, n / 2);
            return ans * ans;
        } else {
            return a * pow(a, n - 1);
        }
    }

    public static void main(String[] args) {
        solve();
        closeStreams();
    }

    private static void closeStreams() {
        in.close();
        out.close();
    }

    private static final FastScanner in = new FastScanner();
    private static final PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

    public static class FastScanner {

        private BufferedReader br;
        private StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        void close() {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}


import java.io.*;
import java.util.*;

public class A {

    private static long modulo = 1000000007;

    private static void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int b = in.nextInt();
        modulo = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        long[][] dp = new long[m + 1][b + 1];
        dp[0][0] = 1;
        for (int i = 0; i < n; i++) {
            for (int v = 0; v < m; v++) {
                for (int j = 0; j <= b; j++) {
                    if (j + a[i] <= b) {
                        dp[v + 1][j + a[i]] += dp[v][j];
                        if (dp[v + 1][j + a[j]] >= modulo) {
                            dp[v + 1][j + a[i]] -= modulo;
                        }
                    }
                }
            }
        }
        long result = 0;
        for (int j = 0; j <= b; j++) {
            result += dp[m][j];
            if (result >= modulo) {
                result -= modulo;
            }
        }
        out.println(result);
    }

    private static long inverse(long a) {
        long result = 1;
        int n = (int) modulo - 2;
        while (n != 0) {
            if ((n & 1) == 1)
                result = (result * a) % modulo;
            a = (a * a) % modulo;
            n >>= 1;
        }
        return result;
    }

    private static long pow(long a, long n) {
        if (n == 0) return 1;
        if (n % 2 == 0) {
            long ans = pow(a, n / 2);
            return ans * ans;
        } else {
            return a * pow(a, n - 1);
        }
    }

    public static void main(String[] args) {
        solve();
        closeStreams();
    }

    private static void closeStreams() {
        in.close();
        out.close();
    }

    private static final FastScanner in = new FastScanner();
    private static final PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

    public static class FastScanner {

        private BufferedReader br;
        private StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        void close() {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        int n;
        int m;
        int b;
        int mod;
        int[] a;
        long[][] dp;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.readInt();
            m = in.readInt();
            b = in.readInt();
            mod = in.readInt();
            a = in.readIntArray(n);
            dp = new long[m + 1][b + 1];

            for (int i = 0; i <= b; i++) dp[0][i] = 1;

            for (int i = 0; i < n; i++) {
                long[][] res = new long[m + 1][b + 1];
                for (int j = 0; j <= b; j++) res[0][j] = 1;
                for (int j = 1; j <= m; j++) {
                    for (int k = 0; k <= b; k++) {
                        res[j][k] = (res[j][k] + dp[j][k]) % mod;
                        if (k - a[i] >= 0) res[j][k] = (res[j][k] + res[j - 1][k - a[i]]) % mod;
                    }
                }
                dp = res;
            }
            out.print(dp[m][b]);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] readIntArray(int size) {
            int[] ans = new int[size];
            for (int i = 0; i < size; i++) ans[i] = readInt();
            return ans;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        int n;
        int m;
        int b;
        int mod;
        int[] a;
        int[][] dp;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.readInt();
            m = in.readInt();
            b = in.readInt();
            mod = in.readInt();
            a = in.readIntArray(n);
            dp = new int[m + 1][b + 1];

            for (int i = 0; i <= b; i++) dp[0][i] = 1;

            for (int i = 0; i < n; i++) {
                int[][] res = dp.clone();
                for (int j = 1; j <= m; j++) {
                    for (int k = a[i]; k <= b; k++) {
                        res[j][k] = (int) (((long) res[j][k] + (j == 1 ? 1 : res[j - 1][k - a[i]])) % mod);
                    }
                }
                dp = res;
            }
            out.print(dp[m][b]);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] readIntArray(int size) {
            int[] ans = new int[size];
            for (int i = 0; i < size; i++) ans[i] = readInt();
            return ans;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        int n;
        int m;
        int b;
        int mod;
        int[] a;
        int[][] dp;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.readInt();
            m = in.readInt();
            b = in.readInt();
            mod = in.readInt();
            a = in.readIntArray(n);
            dp = new int[m + 1][b + 1];

            for (int i = 0; i <= b; i++) dp[0][i] = 1;

            for (int i = 0; i < n; i++) {
                int[][] res = new int[m + 1][b + 1];
                for (int j = 1; j <= m; j++) {
                    for (int k = 0; k <= b; k++) {
                        res[j][k] = (int) (((long) res[j][k] + dp[j][k]) % mod);
                        if (k - a[i] >= 0)
                            res[j][k] = (int) (((long) res[j][k] + (j == 1 ? 1 : res[j - 1][k - a[i]])) % mod);
                    }
                }
                dp = res;
            }
            out.print(dp[m][b]);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] readIntArray(int size) {
            int[] ans = new int[size];
            for (int i = 0; i < size; i++) ans[i] = readInt();
            return ans;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        int n;
        int m;
        int b;
        int mod;
        int[] a;
        long[][] dp;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.readInt();
            m = in.readInt();
            b = in.readInt();
            mod = in.readInt();
            a = in.readIntArray(n);
            dp = new long[m + 1][b + 1];

            for (int i = 0; i <= b; i++) dp[0][i] = 1;

            for (int i = 0; i < n; i++) {
                long[][] res = new long[m + 1][b + 1];
                for (int j = 1; j <= m; j++) {
                    for (int k = 0; k <= b; k++) {
                        res[j][k] = (res[j][k] + dp[j][k]) % mod;
                        if (k - a[i] >= 0) res[j][k] = (res[j][k] + (j == 1 ? 1 : res[j - 1][k - a[i]])) % mod;
                    }
                }
                dp = res;
            }
            out.print(dp[m][b]);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] readIntArray(int size) {
            int[] ans = new int[size];
            for (int i = 0; i < size; i++) ans[i] = readInt();
            return ans;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ProblemAWritingCode solver = new ProblemAWritingCode();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemAWritingCode {
        int mod;
        int n;
        int m;
        int maxBug;
        int[] bug;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            m = in.nextInt();
            maxBug = in.nextInt();
            mod = in.nextInt();
            bug = new int[n];
            for (int i = 0; i < n; ++i) bug[i] = in.nextInt();
//        memo = new int[n + 1][maxBug + 1][m + 1];

            int[][] prev = new int[maxBug + 1][m + 1];
            int[][] cur = new int[maxBug + 1][m + 1];

            for (int bugs = 0; bugs <= maxBug; ++bugs) {
//            memo[n][bugs][0] = 1;
                prev[bugs][0] = 1;
            }

            for (int ind = n - 1; ind >= 0; --ind) {
                for (int bugs = maxBug; bugs >= 0; --bugs) {
                    for (int linesLeft = 0; linesLeft <= m; ++linesLeft) {
                        int choose, skip;
                        if (bugs + bug[ind] > maxBug || linesLeft - 1 < 0) choose = 0;
                        else choose = cur[bugs + bug[ind]][linesLeft - 1];
                        if (ind + 1 == n) skip = linesLeft == 0 ? 1 : 0;
                        else skip = prev[bugs][linesLeft];
                        cur[bugs][linesLeft] = (choose + skip) % mod;
                    }
                }
                int[][] tmp = prev;
                prev = cur;
                cur = tmp;
            }
            out.println(prev[0][m]);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ProblemAWritingCode solver = new ProblemAWritingCode();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemAWritingCode {
        int mod;
        int n;
        int m;
        int maxBug;
        int[] bug;
        int[][][] memo;

        int dp(int ind, int bugs, int linesLeft) {
            if (bugs > maxBug || linesLeft < 0) return 0;
            if (ind == n) return bugs <= maxBug ? 1 : 0;
            if (memo[ind][bugs][linesLeft] != -1) return memo[ind][bugs][linesLeft];
            if (ind == n - 1) {
                int newBugs = linesLeft * bug[ind];
                return memo[ind][bugs][linesLeft] = dp(ind + 1, bugs + newBugs, 0);
            }
            int choose = dp(ind, bugs + bug[ind], linesLeft - 1);
            int skip = dp(ind + 1, bugs, linesLeft);
            return memo[ind][bugs][linesLeft] = (choose + skip) % mod;
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            m = in.nextInt();
            maxBug = in.nextInt();
            mod = in.nextInt();
            bug = new int[n];
            for (int i = 0; i < n; ++i) bug[i] = in.nextInt();
            memo = new int[n][maxBug + 1][m + 1];
            for (int[][] b : memo) for (int[] a : b) Arrays.fill(a, -1);
            out.println(dp(0, 0, m));
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.util.*;

public class A {
	static int mod;
	static int[][][] memo;
	static int[] bpp;
	static int b;
	public static void main(String[] args) {

		Scanner qwe = new Scanner(System.in);

		int n = qwe.nextInt();
		int m = qwe.nextInt();
		b = qwe.nextInt();
		mod = qwe.nextInt();

		bpp = new int[n];

		for (int i = 0; i < bpp.length; i++) {
			bpp[i] = qwe.nextInt();
		}

		int[][][] dp = new int[2][b+1][n];
		dp[0][0][0] = 1;

		for(int i =1; i <= m; i++){
			int par = i&1;

			int[][] sums = new int[b+1][n];

			for(int bugs = 0; bugs <= b; bugs++){
				sums[bugs][0] = dp[1-par][bugs][0];
				for(int pro =1; pro < n; pro++){
					sums[bugs][pro] = (sums[bugs][pro-1]+dp[1-par][bugs][pro])%mod;
				}
			}

			for(int pro =0; pro< n; pro++){

				for(int bugs = 0; bugs < bpp[pro] && bugs <= b; bugs++) dp[par][bugs][pro] = 0;
				for(int bugs =bpp[pro]; bugs <= b; bugs++){
					dp[par][bugs][pro] = sums[bugs-bpp[pro]][pro];
					//System.out.println("i: " + i  +" pro " +  pro  + " bugs " + bugs  + " val " + dp[par][bugs][pro] );
				}
				//System.out.println();
			}

		}

		int sum = 0;

		for(int bugs = 0; bugs <= b; bugs++){
			for(int pro = 0; pro < n; pro++){
				sum = (sum + dp[m&1][bugs][pro]) %mod;
			}
		}

		System.out.println(sum);

		qwe.close();
	}

}


import java.util.*;

public class A {
	static int mod;
	static int[][][] memo;
	static int[] bpp;
	static int b;
	public static void main(String[] args) {

		Scanner qwe = new Scanner(System.in);

		int n = qwe.nextInt();
		int m = qwe.nextInt();
		b = qwe.nextInt();
		mod = qwe.nextInt();

		bpp = new int[n];

		for (int i = 0; i < bpp.length; i++) {
			bpp[i] = qwe.nextInt();
		}

		int[][][] dp = new int[2][b+1][n];
		dp[0][0][0] = 1;

		for(int i =1; i <= m; i++){
			int par = i&1;

			int[][] sums = new int[b+1][n];

			for(int bugs = 0; bugs <= b; bugs++){
				sums[bugs][0] = dp[1-par][bugs][0];
				for(int pro =1; pro < n; pro++){
					sums[bugs][pro] = (sums[bugs][pro-1]+dp[1-par][bugs][pro])%mod;
				}
			}

			for(int pro =0; pro< n; pro++){

				for(int bugs = 0; bugs < bpp[pro]; bugs++) dp[par][bugs][pro] = 0;
				for(int bugs =bpp[pro]; bugs <= b; bugs++){
					dp[par][bugs][pro] = sums[bugs-bpp[pro]][pro];
					//System.out.println("i: " + i  +" pro " +  pro  + " bugs " + bugs  + " val " + dp[par][bugs][pro] );
				}
				//System.out.println();
			}

		}

		int sum = 0;

		for(int bugs = 0; bugs <= b; bugs++){
			for(int pro = 0; pro < n; pro++){
				sum = (sum + dp[m&1][bugs][pro]) %mod;
			}
		}

		System.out.println(sum);

		//System.out.println(dp(0,0,0));

		qwe.close();
	}

}


import java.util.*;

public class A {
	static int mod;
	static int[][][] memo;
	static int[] bpp;
	static int b;
	public static void main(String[] args) {

		Scanner qwe = new Scanner(System.in);

		int n = qwe.nextInt();
		int m = qwe.nextInt();
		b = qwe.nextInt();
		mod = qwe.nextInt();

		memo=  new int[m][(int)b+1][n];

		for(int i =0; i< m; i++)
			for(int j =0; j <= b; j++)
				Arrays.fill(memo[i][j], -1);

		bpp = new int[n];

		for (int i = 0; i < bpp.length; i++) {
			bpp[i] = qwe.nextInt();
		}

		int[][][] dp = new int[2][b+1][n];
		dp[0][0][0] = 1;

		for(int i =1; i <= m; i++){
			int par = i&1;

			int[][] sums = new int[b+1][n];

			for(int bugs = 0; bugs <= b; bugs++){
				sums[bugs][0] = dp[1-par][bugs][0];
				for(int pro =1; pro < n; pro++){
					sums[bugs][pro] = (sums[bugs][pro-1]+dp[1-par][bugs][pro])%mod;
				}
			}

			for(int pro =0; pro< n; pro++){

				for(int bugs = 0; bugs < bpp[pro]; bugs++) dp[par][bugs][pro] = 0;
				for(int bugs =bpp[pro]; bugs <= b; bugs++){
					dp[par][bugs][pro] = sums[bugs-bpp[pro]][pro];
					//System.out.println("i: " + i  +" pro " +  pro  + " bugs " + bugs  + " val " + dp[par][bugs][pro] );
				}
				//System.out.println();
			}

		}

		int sum = 0;

		for(int bugs = 0; bugs <= b; bugs++){
			for(int pro = 0; pro < n; pro++){
				sum = (sum + dp[m&1][bugs][pro]) %mod;
			}
		}

		System.out.println(sum);

		//System.out.println(dp(0,0,0));

		qwe.close();
	}

	static int dp(int line, int bugs, int pro){
		if(line == memo.length) return 1;
		if(memo[line][bugs][pro] != -1) return memo[line][bugs][pro];

		int ret = 0;

		if(bugs+bpp[pro] <= b){
			ret += dp(line+1,bugs+bpp[pro],pro);
			ret %= mod;
		}

		if(pro + 1 < bpp.length){
			ret += dp(line,bugs,pro+1);
			ret %= mod;
		}

		return memo[line][bugs][pro] = ret;

	}

}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;

public class _543A {

  public static void main(String[] args) throws Exception {
    Reader.init(System.in);
    BufferedWriter cout = new BufferedWriter(new OutputStreamWriter(System.out));

    int n = Reader.nextInt();
    int m = Reader.nextInt();
    int b = Reader.nextInt();
    int mod = Reader.nextInt();
    int[] a = new int[n + 1];
    for (int i = 1; i <= n; i++)
      a[i] = Reader.nextInt();
    int[][] f = new int[m + 1][b + 1];
    for (int i = 0; i <= b; i++)
      f[0][i] = 1;
    for (int i = 1; i <= n; i++)
      for (int j = 0; j <= m; j++)
        for (int k = 0; k <= b; k++) {
          if (j - 1 >= 0 && k - a[i] >= 0)
            f[j][k] = (f[j][k] + f[j - 1][k - a[i]]) % mod;
        }

    System.out.println(f[m][b]);

    cout.close();
  }

  static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
    final U _1;
    final V _2;

    private Pair(U key, V val) {
      this._1 = key;
      this._2 = val;
    }

    public static <U extends Comparable<U>, V extends Comparable<V>> Pair<U, V> instanceOf(U _1, V _2) {
      return new Pair<U, V>(_1, _2);
    }

    @Override
    public String toString() {
      return _1 + " " + _2;
    }

    @Override
    public int hashCode() {
      int res = 17;
      res = res * 31 + _1.hashCode();
      res = res * 31 + _2.hashCode();
      return res;
    }

    @Override
    public int compareTo(Pair<U, V> that) {
      int res = this._1.compareTo(that._1);
      if (res < 0 || res > 0)
        return res;
      else
        return this._2.compareTo(that._2);
    }

    @Override
    public boolean equals(Object obj) {
      if (this == obj)
        return true;
      if (!(obj instanceof Pair))
        return false;
      Pair<?, ?> that = (Pair<?, ?>) obj;
      return _1.equals(that._1) && _2.equals(that._2);
    }
  }

  /** Class for buffered reading int and double values */
  static class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
      reader = new BufferedReader(new InputStreamReader(input));
      tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
      while (!tokenizer.hasMoreTokens()) {
        // TODO add check for eof if necessary
        tokenizer = new StringTokenizer(reader.readLine());
      }
      return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
      return Integer.parseInt(next());
    }

    static double nextDouble() throws IOException {
      return Double.parseDouble(next());
    }
  }

  static class ArrayUtil {
    static void swap(int[] a, int i, int j) {
      int tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void swap(long[] a, int i, int j) {
      long tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void swap(double[] a, int i, int j) {
      double tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void swap(char[] a, int i, int j) {
      char tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void swap(boolean[] a, int i, int j) {
      boolean tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void reverse(int[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static void reverse(long[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static void reverse(double[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static void reverse(char[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static void reverse(boolean[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static long sum(int[] a) {
      int sum = 0;
      for (int i : a)
        sum += i;
      return sum;
    }

    static long sum(long[] a) {
      long sum = 0;
      for (long i : a)
        sum += i;
      return sum;
    }

    static double sum(double[] a) {
      double sum = 0;
      for (double i : a)
        sum += i;
      return sum;
    }

    static int max(int[] a) {
      int max = Integer.MIN_VALUE;
      for (int i : a)
        if (i > max)
          max = i;
      return max;
    }

    static int min(int[] a) {
      int min = Integer.MAX_VALUE;
      for (int i : a)
        if (i < min)
          min = i;
      return min;
    }

    static long max(long[] a) {
      long max = Long.MIN_VALUE;
      for (long i : a)
        if (i > max)
          max = i;
      return max;
    }

    static long min(long[] a) {
      long min = Long.MAX_VALUE;
      for (long i : a)
        if (i < min)
          min = i;
      return min;
    }
  }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;

public class _543A {

  public static void main(String[] args) throws Exception {
    Reader.init(System.in);
    BufferedWriter cout = new BufferedWriter(new OutputStreamWriter(System.out));

    int n = Reader.nextInt();
    int m = Reader.nextInt();
    int b = Reader.nextInt();
    int mod = Reader.nextInt();
    int[] a = new int[n + 1];
    for (int i = 1; i <= n; i++)
      a[i] = Reader.nextInt();
    int[][][] f = new int[n + 1][m + 1][b + 1];
    for (int i = 0; i <= b; i++)
      f[0][0][i] = 1;
    for (int i = 1; i <= n; i++)
      for (int j = 0; j <= m; j++)
        for (int k = 0; k <= b; k++) {
          f[i][j][k] = f[i - 1][j][k];
          if (j - 1 >= 0 && k - a[i] >= 0)
            f[i][j][k] = (f[i][j][k] + f[i][j - 1][k - a[i]]) % mod;
        }

    System.out.println(f[n][m][b]);

    cout.close();
  }

  static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
    final U _1;
    final V _2;

    private Pair(U key, V val) {
      this._1 = key;
      this._2 = val;
    }

    public static <U extends Comparable<U>, V extends Comparable<V>> Pair<U, V> instanceOf(U _1, V _2) {
      return new Pair<U, V>(_1, _2);
    }

    @Override
    public String toString() {
      return _1 + " " + _2;
    }

    @Override
    public int hashCode() {
      int res = 17;
      res = res * 31 + _1.hashCode();
      res = res * 31 + _2.hashCode();
      return res;
    }

    @Override
    public int compareTo(Pair<U, V> that) {
      int res = this._1.compareTo(that._1);
      if (res < 0 || res > 0)
        return res;
      else
        return this._2.compareTo(that._2);
    }

    @Override
    public boolean equals(Object obj) {
      if (this == obj)
        return true;
      if (!(obj instanceof Pair))
        return false;
      Pair<?, ?> that = (Pair<?, ?>) obj;
      return _1.equals(that._1) && _2.equals(that._2);
    }
  }

  /** Class for buffered reading int and double values */
  static class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
      reader = new BufferedReader(new InputStreamReader(input));
      tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
      while (!tokenizer.hasMoreTokens()) {
        // TODO add check for eof if necessary
        tokenizer = new StringTokenizer(reader.readLine());
      }
      return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
      return Integer.parseInt(next());
    }

    static double nextDouble() throws IOException {
      return Double.parseDouble(next());
    }
  }

  static class ArrayUtil {
    static void swap(int[] a, int i, int j) {
      int tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void swap(long[] a, int i, int j) {
      long tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void swap(double[] a, int i, int j) {
      double tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void swap(char[] a, int i, int j) {
      char tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void swap(boolean[] a, int i, int j) {
      boolean tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void reverse(int[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static void reverse(long[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static void reverse(double[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static void reverse(char[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static void reverse(boolean[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static long sum(int[] a) {
      int sum = 0;
      for (int i : a)
        sum += i;
      return sum;
    }

    static long sum(long[] a) {
      long sum = 0;
      for (long i : a)
        sum += i;
      return sum;
    }

    static double sum(double[] a) {
      double sum = 0;
      for (double i : a)
        sum += i;
      return sum;
    }

    static int max(int[] a) {
      int max = Integer.MIN_VALUE;
      for (int i : a)
        if (i > max)
          max = i;
      return max;
    }

    static int min(int[] a) {
      int min = Integer.MAX_VALUE;
      for (int i : a)
        if (i < min)
          min = i;
      return min;
    }

    static long max(long[] a) {
      long max = Long.MIN_VALUE;
      for (long i : a)
        if (i > max)
          max = i;
      return max;
    }

    static long min(long[] a) {
      long min = Long.MAX_VALUE;
      for (long i : a)
        if (i < min)
          min = i;
      return min;
    }
  }
}


import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main1 {
	static PrintWriter out = new PrintWriter(System.out, true);
	static FastReader input = new FastReader();

	static int n, M, B, MOD, a[];

	static long solve(int i, int b, int m) {
		if (m == 0 && b >= 0) {
			return 1;
		}
		if (b < 0 || m < 0 || i < 0) {
			return 0;
		}

		return solve(i - 1, b, m) + solve(i, b - a[i], m - 1);

	}

	public static void main(String[] args) throws IOException {
		n = input.nextInt();
		M = input.nextInt();
		B = input.nextInt();
		MOD = input.nextInt();
		a = new int[n];
		for (int i = 0; i < n; i++) { a[i] = input.nextInt(); }
		// out.println(solve(n - 1, B, M));

		long dp[][][] = new long[2][B + 1][M + 1];

		for (int i = 0; i <= B; i++) { dp[n & 1][i][M] = 1; }

		for (int i = n - 1; i >= 0; i--) {
			for (int b = B; b >= 0; b--) {
				for (int m = M; m >= 0; m--) {
					dp[i & 1][b][m] = dp[(i & 1) ^ 1][b][m];
					if (b + a[i] <= B && m + 1 <= M)
						dp[i & 1][b][m] += dp[i & 1][b + a[i]][m + 1];
					dp[i & 1][b][m] %= MOD;
				}
			}
		}

		out.println(dp[0][0][0]);
		// out.println(Arrays.deepToString(dp));
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			// try {
			// br = new BufferedReader(new FileReader(new File("overcode.in")));
			// } catch (FileNotFoundException e) {
			// e.printStackTrace();
			// }
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreElements()) { st = new StringTokenizer(br.readLine()); }
			return st.nextToken();
		}

		int nextInt() throws NumberFormatException, IOException { return Integer.parseInt(next()); }

		long nextLong() throws NumberFormatException, IOException { return Long.parseLong(next()); }

		double nextDouble() throws NumberFormatException, IOException { return Double.parseDouble(next()); }

		String nextLine() throws IOException {
			String str = "";
			str = br.readLine();
			return str;
		}

		boolean hasNext() throws IOException { return br.ready(); }
	}

	static class con {
		static int IINF = (int) 1e9;
		static int _IINF = (int) -1e9;
		static long LINF = (long) 1e15;
		static long _LINF = (long) -1e15;
		static double EPS = 1e-9;
	}

	static class Triple implements Comparable<Triple> {
		int x;
		int y;

		int z;

		Triple(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}

		@Override
		public int compareTo(Triple o) {
			if (x == o.x && y == o.y)
				return z - o.z;
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}

		@Override
		public String toString() { return "(" + x + ", " + y + ", " + z + ")"; }
	}

	static class Pair implements Comparable<Pair> {
		int x;
		int y;

		Pair(int x, int y) {
			this.x = x;
			this.y = y;

		}

		@Override
		public int compareTo(Pair o) {
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}

		@Override
		public String toString() {

			return "(" + x + ", " + y + ")";
		}

	}

	static void shuffle(int[] a) {
		for (int i = 0; i < a.length; i++) {
			int r = i + (int) (Math.random() * (a.length - i));
			int tmp = a[r];
			a[r] = a[i];
			a[i] = tmp;
		}
	}

	static int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }

	static class DSU {

		int[] p, rank, setSize;
		int numSets;

		DSU(int n) {
			p = new int[n];
			rank = new int[n];
			setSize = new int[n];
			numSets = n;

			for (int i = 0; i < n; i++) {
				p[i] = i;
				setSize[i] = 1;
			}

		}

		int findSet(int n) { return p[n] = p[n] == n ? n : findSet(p[n]); }

		boolean isSameSet(int n, int m) { return findSet(n) == findSet(m); }

		void mergeSet(int n, int m) {

			if (!isSameSet(n, m)) {
				numSets--;
				int p1 = findSet(n);
				int p2 = findSet(m);

				if (rank[p1] > rank[p2]) {
					p[p2] = p1;
					setSize[p1] += setSize[p2];
				} else {
					p[p1] = p2;
					setSize[p2] += setSize[p1];
					if (rank[p1] == rank[p2])
						rank[p1]++;
				}
			}

		}

		int size() { return numSets; }

		int setSize(int n) { return setSize[findSet(n)]; }

	}

	static class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException {
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException {
			byte[] buf = new byte[1024];
			int cnt = 0, c;
			while ((c = read()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}
}


//package practice;
/**
 * Created by Rajan Waliya on 06-Sep-15.
 */

import java.io.*;
import java.util.*;

//public
class A543 {

    Reader sc;
    PrintWriter out;
    int n,m,b,mod;
    int[] a;
    int count=0;

    void BruteForce(int i,int bugs,int lines,LinkedList<Integer> lt){
        //not possible, exceeded range
        if(bugs>b||lines>n){return;}
        //if covered all n successfully
        if(i>=n){
            if(lines==m){
            //System.out.println(lt.toString()+" "+bugs+" "+lines);
            count++;}
            return;
        }
        // j is vi value
        // try every value of j
        for(int j=0;j<=n;j++){
            lt.add(j);
            BruteForce(i+1,bugs+j*a[i],lines+j,lt);
            lt.remove(lt.size()-1);
        }
    }

    void solve() throws IOException {
        n = sc.nextInt();
        m = sc.nextInt();
        b = sc.nextInt();
        mod = sc.nextInt();
        a = new int[n];
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
        }
        count=0;
        LinkedList<Integer> lt = new LinkedList<>();
        BruteForce(0,0,0,lt);
        count%=mod;
        out.println(count);
    }

    //_______congratulation!!! main logic has ended, no need to understand what is after this line.________
    void runIO() throws Exception {
        sc = new Reader();
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new A543().runIO();
    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10L + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.')
                while ((c = read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);
            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public String next() throws IOException {
            StringBuilder sb = new StringBuilder();
            byte c;
            while ((c = read()) <= ' ') ;
            do {
                sb.append((char) c);
            } while ((c = read()) > ' ');
            return sb.toString();
        }

        public int nextInt2() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }

}


//package practice;
/**
 * Created by Rajan Waliya on 06-Sep-15.
 */

import java.io.*;
import java.util.*;

//public
class A543 {

    Reader sc;
    PrintWriter out;
    int n;
    long m,b,mod;
    long[] a;
    long count;

    void BruteForce(int i,long bugs,long lines){
        //not possible, exceeded range
        if(bugs>b||lines>n){return;}
        //if covered all n successfully
        if(i>=n){
            if(lines==m){
            //System.out.println(lt.toString()+" "+bugs+" "+lines);
            count++;}
            return;
        }
        // j is vi value
        // try every value of j
        for(int j=0;j<=n;j++){
            BruteForce(i+1,bugs+(long)(j*a[i]),lines+j);
        }
    }

    void solve() throws IOException {
        n = sc.nextInt();
        m = sc.nextInt();
        b = sc.nextInt();
        mod = sc.nextInt();
        a = new long[n];
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
        }
        count=0;
        BruteForce(0,0,0);
        count%=mod;
        out.println(count);
    }

    //_______congratulation!!! main logic has ended, no need to understand what is after this line.________
    void runIO() throws Exception {
        sc = new Reader();
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new A543().runIO();
    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10L + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.')
                while ((c = read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);
            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public String next() throws IOException {
            StringBuilder sb = new StringBuilder();
            byte c;
            while ((c = read()) <= ' ') ;
            do {
                sb.append((char) c);
            } while ((c = read()) > ' ');
            return sb.toString();
        }

        public int nextInt2() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }

}


//package practice;
/**
 * Created by Rajan Waliya on 06-Sep-15.
 */

import java.io.*;
import java.util.*;

//public
class A543 {

    Reader sc;
    PrintWriter out;
    int n;
    long m,b,mod;
    long[] a;
    long count;

    void BruteForce(int i,long bugs,long lines,LinkedList<Integer> lt){
//        if(i==n){
//            System.out.println(lt.toString());}
        //not possible, exceeded range
//        if(bugs>b||lines>n){
//            return;}
        //if covered all n successfully
        if(i>=n){
            if(lines==m&&bugs<=b){
            count=(count+1)%mod;}
            return;
        }
        // j is vi value
        // try every value of j
        for(int j=0;j<=n;j++){
            lt.add(j);
            BruteForce(i + 1, bugs + (long) (j * a[i]), lines + j, lt);
            lt.remove(lt.size()-1);
        }
    }

    void solve() throws IOException {
        n = sc.nextInt();
        m = sc.nextInt();
        b = sc.nextInt();
        mod = sc.nextInt();
        a = new long[n];
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
        }
        count=0;
        LinkedList<Integer> lt = new LinkedList<>();
        BruteForce(0,0,0,lt);
        count%=mod;
        out.println(count);
    }

    //_______congratulation!!! main logic has ended, no need to understand what is after this line.________
    void runIO() throws Exception {
        sc = new Reader();
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new A543().runIO();
    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10L + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.')
                while ((c = read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);
            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public String next() throws IOException {
            StringBuilder sb = new StringBuilder();
            byte c;
            while ((c = read()) <= ' ') ;
            do {
                sb.append((char) c);
            } while ((c = read()) > ' ');
            return sb.toString();
        }

        public int nextInt2() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }

}


//package practice;
/**
 * Created by Rajan Waliya on 06-Sep-15.
 */

import java.io.*;
import java.util.*;

//public
class A543 {

    Reader sc;
    PrintWriter out;
    int n;
    int m,b,mod;
    int[] ar;
    int count;

    void BruteForce(int i,long bugs,long lines){
        //not possible, exceeded range
        if(bugs>b||lines>m){
            return;}
        //if covered all n successfully
        if(i>=n){
            if(lines==m&&bugs<=b){
            count=(count+1)%mod;}
            return;
        }
        // j is vi value
        // try every value of j
        for(int j=0;j<=m;j++){
            BruteForce(i + 1, bugs + (long) (j * ar[i]), lines + j);
        }
    }

    void solve() throws IOException {
        n = sc.nextInt();
        m = sc.nextInt();
        b = sc.nextInt();
        mod = sc.nextInt();
        ar = new int[n];
        for(int i=0;i<n;i++){
            ar[i]=sc.nextInt();
        }

        int[][] w = new int[m+1][b+1]; //number of ways to put j bugs in upto i lines
        w[0][0]=1;
        for(int i=0;i<n;i++){//for each coder
            for(int j=0;j<m;j++){//for each line
                for(int bg=0;bg+ar[i]<b+1;bg++){
                    w[j+1][bg+ar[i]]+=w[j][bg];
                    if (w[j + 1][bg + ar[i]] >= mod) w[j + 1][bg + ar[i]] -= mod;
                }
            }
        }
        long sum=0;
        for(int i=0;i<=b;i++){
            sum=(sum+w[m][i])%mod;
        }

        System.out.println(sum%mod);
    }

    //_______congratulation!!! main logic has ended, no need to understand what is after this line.________
    void runIO() throws Exception {
        sc = new Reader();
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new A543().runIO();
    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10L + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.')
                while ((c = read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);
            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public String next() throws IOException {
            StringBuilder sb = new StringBuilder();
            byte c;
            while ((c = read()) <= ' ') ;
            do {
                sb.append((char) c);
            } while ((c = read()) > ' ');
            return sb.toString();
        }

        public int nextInt2() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }

}


//package practice;
/**
 * Created by Rajan Waliya on 06-Sep-15.
 */

import java.io.*;
import java.util.*;

//public
class A543 {

    Reader sc;
    PrintWriter out;
    int n;
    long m,b,mod;
    long[] a;
    long count;

    void BruteForce(int i,long bugs,long lines,LinkedList<Integer> lt){
        //not possible, exceeded range
        if(bugs>b||lines>m){
            return;}
        //if covered all n successfully
        if(i>=n){
            if(lines==m&&bugs<=b){
               // System.out.println(bugs+" "+lt.toString());
            count=(count+1)%mod;}
            return;
        }
        // j is vi value
        // try every value of j
        for(int j=0;j<=m;j++){
            lt.add(j);
            BruteForce(i + 1, bugs + (long) (j * a[i]), lines + j, lt);
            lt.remove(lt.size()-1);
        }
    }

    void solve() throws IOException {
        n = sc.nextInt();
        m = sc.nextInt();
        b = sc.nextInt();
        mod = sc.nextInt();
        a = new long[n];
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
        }
        count=0;
        LinkedList<Integer> lt = new LinkedList<>();
        BruteForce(0,0,0,lt);
        count%=mod;
        out.println(count);
    }

    //_______congratulation!!! main logic has ended, no need to understand what is after this line.________
    void runIO() throws Exception {
        sc = new Reader();
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new A543().runIO();
    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10L + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.')
                while ((c = read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);
            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public String next() throws IOException {
            StringBuilder sb = new StringBuilder();
            byte c;
            while ((c = read()) <= ' ') ;
            do {
                sb.append((char) c);
            } while ((c = read()) > ' ');
            return sb.toString();
        }

        public int nextInt2() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }

}


//package practice;
/**
 * Created by Rajan Waliya on 06-Sep-15.
 */

import java.io.*;
import java.util.*;

//public
class A543 {

    Reader sc;
    PrintWriter out;
    int n;
    long m,b,mod;
    long[] a;
    long count;

    void BruteForce(int i,long bugs,long lines){
        //not possible, exceeded range
        if(bugs>b||lines>n){return;}
        //if covered all n successfully
        if(i>=n){
            if(lines==m){
            //System.out.println(lt.toString()+" "+bugs+" "+lines);
            count=(count+1)%mod;}
            return;
        }
        // j is vi value
        // try every value of j
        for(int j=0;j<=n;j++){
            BruteForce(i+1,bugs+(long)(j*a[i]),lines+j);
        }
    }

    void solve() throws IOException {
        n = sc.nextInt();
        m = sc.nextInt();
        b = sc.nextInt();
        mod = sc.nextInt();
        a = new long[n];
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
        }
        count=0;
        BruteForce(0,0,0);
        count%=mod;
        out.println(count);
    }

    //_______congratulation!!! main logic has ended, no need to understand what is after this line.________
    void runIO() throws Exception {
        sc = new Reader();
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new A543().runIO();
    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10L + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.')
                while ((c = read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);
            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public String next() throws IOException {
            StringBuilder sb = new StringBuilder();
            byte c;
            while ((c = read()) <= ' ') ;
            do {
                sb.append((char) c);
            } while ((c = read()) > ' ');
            return sb.toString();
        }

        public int nextInt2() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }

}


//package practice;
/**
 * Created by Rajan Waliya on 06-Sep-15.
 */

import java.io.*;
import java.util.*;

//public
class A543 {

    Reader sc;
    PrintWriter out;
    int n;
    long m,b,mod;
    long[] a;
    long count;

    void BruteForce(int i,long bugs,long lines){
        //not possible, exceeded range
        if(bugs>b||lines>m){
            return;}
        //if covered all n successfully
        if(i>=n){
            if(lines==m&&bugs<=b){
            count=(count+1)%mod;}
            return;
        }
        // j is vi value
        // try every value of j
        for(int j=0;j<=m;j++){
            BruteForce(i + 1, bugs + (long) (j * a[i]), lines + j);
        }
    }

    void solve() throws IOException {
        n = sc.nextInt();
        m = sc.nextInt();
        b = sc.nextInt();
        mod = sc.nextInt();
        a = new long[n];
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
        }
        count=0;
        BruteForce(0,0,0);
        count%=mod;
        out.println(count);
    }

    //_______congratulation!!! main logic has ended, no need to understand what is after this line.________
    void runIO() throws Exception {
        sc = new Reader();
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new A543().runIO();
    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10L + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.')
                while ((c = read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);
            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public String next() throws IOException {
            StringBuilder sb = new StringBuilder();
            byte c;
            while ((c = read()) <= ' ') ;
            do {
                sb.append((char) c);
            } while ((c = read()) > ' ');
            return sb.toString();
        }

        public int nextInt2() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }

}