#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
const int maxn = 2e3 + 10;
const int mod = 1e9 + 7;
const long long infll = 1e18;
const int inf = 1e9;
int pw[5005][5005];
int ways[5005][5005];
int dp[2][5005];
int R[5005];
int fact[5005];
int32_t main() {
  int n = in(), m = in(), MOD = in();
  R[0] = 1;
  fact[0] = 1;
  for (int i = 1; i <= 5000; i++)
    R[i] = 1LL * R[i - 1] * (m - i + 1) % MOD,
    fact[i] = 1LL * fact[i - 1] * i % MOD;
  ways[0][0] = true;
  for (int i = 1; i <= 5000; i++) {
    for (int j = 1; j <= i; j++) {
      ways[i][j] =
          (ways[i - 1][j - 1] + 1LL * ways[i - 1][j] * (j - 1) % MOD) % MOD;
    }
  }
  dp[0][0] = 1;
  int pref = 1;
  for (int i = 1; i <= n; i++) {
    memset(dp[i & 1], 0, sizeof dp[i & 1]);
    int l = in();
    for (int j = 1; j <= l; j++) {
      dp[i & 1][j] =
          (1LL * pref * ways[l][j] % MOD * R[j] % MOD -
           1LL * dp[(i - 1) & 1][j] * ways[l][j] % MOD * fact[j] % MOD + MOD) %
          MOD;
    }
    pref = 0;
    for (int j = 1; j <= l; j++) pref = (pref + dp[i & 1][j]) % MOD;
  }
  cout << pref << "\n";
}
