#include <bits/stdc++.h>
long long n, m, p;
long long lmax;
long long Am[50001];
long long fac[50001];
long long l[2000000];
long long f[5010][5010];
long long g[2][5010];
int main() {
  scanf("%lld%lld%lld", &n, &m, &p);
  fac[0] = Am[0] = f[0][0] = 1;
  for (int i = 1; i <= n; i++)
    scanf("%lld", &l[i]), lmax = std::max(lmax, l[i]);
  for (int i = 1; i <= lmax; i++) Am[i] = Am[i - 1] * (m - i + 1) % p;
  for (int i = 1; i <= lmax; i++) fac[i] = fac[i - 1] * i % p;
  for (int i = 1; i <= lmax; i++)
    for (int j = 1; j <= i && j <= m; j++)
      f[i][j] = (f[i - 1][j - 1] + f[i - 1][j] * (j - 1)) % p;
  long long ans = 1, sum = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= l[i]; j++) {
      long long tmp = (Am[j] * ans - g[i & 1 ^ 1][j] * fac[j]) % p;
      g[i & 1][j] = f[l[i]][j] * tmp % p;
      sum += g[i & 1][j];
    }
    ans = (sum % p + p) % p;
    sum = 0;
    memset(g[i & 1 ^ 1], 0, sizeof(g[0]));
  }
  printf("%lld\n", ans);
  return 0;
}
