#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
int n, m, p, l[1000010], f[N][N], g[N], s;
long long C[N], P[N];
int get(int i, int j) {
  if (j > l[i - 1])
    return 0;
  else
    return g[j];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m >> p;
  for (int i = 1; i <= n; i++) {
    cin >> l[i];
  }
  f[0][0] = P[0] = C[0] = 1;
  for (int i = 1; i <= 5000; i++) {
    P[i] = P[i - 1] * (m - i + 1) % p;
    C[i] = C[i - 1] * i % p;
    for (int j = 1; j <= i; j++)
      f[i][j] = (f[i - 1][j - 1] + (long long)f[i - 1][j] * (j - 1)) % p;
  }
  s = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= l[i]; j++)
      g[j] = f[l[i]][j] * ((P[j] * s - C[j] * get(i, j)) % p) % p;
    s = 0;
    for (int j = 0; j <= l[i]; j++) s = (s + g[j]) % p;
  }
  cout << (s + p) % p;
}
