#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, t = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') t = -1, ch = getchar();
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
  return x * t;
}
int n, m, MOD;
int l[5100 * 200], A[5100], jc[5100], f[5100][5100];
int dp[2][5100], ans[2];
int fpow(int a, int b) {
  int s = 1;
  while (b) {
    if (b & 1) s = 1ll * s * a % MOD;
    a = 1ll * a * a % MOD;
    b >>= 1;
  }
  return s;
}
int main() {
  n = read();
  m = read();
  MOD = read();
  for (int i = 1; i <= n; ++i) l[i] = read();
  f[0][0] = 1;
  for (int i = 1; i <= 5000; ++i)
    for (int j = 1; j <= i; ++j)
      f[i][j] = (f[i - 1][j - 1] + 1ll * f[i - 1][j] * (j - 1) % MOD) % MOD;
  A[0] = 1;
  for (int i = 1; i <= 5000; ++i) A[i] = 1ll * A[i - 1] * (m + 1 - i) % MOD;
  jc[0] = 1;
  for (int i = 1; i <= 5000; ++i) jc[i] = 1ll * jc[i - 1] * i % MOD;
  ans[0] = 1;
  for (int i = 1; i <= n; ++i) {
    ans[i & 1] = 0;
    for (int j = 1; j <= l[i]; ++j) {
      dp[i & 1][j] = 1ll * A[j] * ans[(i & 1) ^ 1] % MOD * f[l[i]][j] % MOD;
      if (j <= l[i - 1])
        dp[i & 1][j] =
            (dp[i & 1][j] -
             1ll * jc[j] * dp[(i & 1) ^ 1][j] % MOD * f[l[i]][j] % MOD + MOD) %
            MOD;
      ans[i & 1] = (ans[i & 1] + dp[i & 1][j]) % MOD;
    }
  }
  printf("%d\n", ans[n & 1]);
  return 0;
}
