#include <bits/stdc++.h>
using namespace std;
vector<int> g[1000000];
int f[5001][5001], a[100000], l[1000000], c[5001], tmp[5001];
int main() {
  int n, m, p;
  scanf("%d%d%d", &n, &m, &p);
  for (int i = 0; i < n; i++) scanf("%d", &l[i]);
  memset(f, 0, sizeof(f));
  f[0][0] = 1;
  for (int i = 1; i <= 5000; i++)
    for (int j = 1; j <= i; j++)
      f[i][j] =
          ((long long)f[i - 1][j] * (j - 1) + (long long)f[i - 1][j - 1] * j) %
          p;
  memset(a, 0, sizeof(a));
  a[0] = a[1] = 1;
  for (int i = 1; i <= 5000; i++) {
    long long w = 0;
    for (int j = 1; j <= a[0]; j++) {
      long long t = (long long)a[j] * (m - i + 1) + w;
      a[j] = t % 10000;
      w = t / 10000;
    }
    while (w > 0) {
      a[++a[0]] = w % 10000;
      w /= 10000;
    }
    w = 0;
    for (int j = a[0]; j > 0; j--) {
      w = w * 10000 + a[j];
      a[j] = w / i;
      w = w % i;
    }
    while (a[a[0]] == 0) a[0]--;
    c[i] = 0;
    for (int j = a[0]; j > 0; j--) c[i] = ((long long)c[i] * 10000 + a[j]) % p;
  }
  g[0].resize(l[0] + 1);
  for (int i = 1; i <= l[0]; i++) g[0][i] = (long long)f[l[0]][i] * c[i] % p;
  for (int i = 1; i < n; i++) {
    int sum = 0;
    g[i].resize(l[i] + 1);
    for (int j = 1; j <= l[i - 1]; j++) sum = (sum + g[i - 1][j]) % p;
    for (int j = 1; j <= l[i]; j++) {
      int tmp = (long long)sum * f[l[i]][j] % p;
      tmp = (long long)tmp * c[j] % p;
      g[i][j] = tmp;
    }
    for (int j = 1; j <= l[i - 1] && j <= l[i]; j++) {
      int tmp = (long long)g[i - 1][j] * f[l[i]][j] % p;
      g[i][j] = (g[i][j] - tmp) % p;
    }
  }
  int ans = 0;
  for (int i = 1; i <= l[n - 1]; i++) ans = (ans + g[n - 1][i]) % p;
  ans = (ans + p) % p;
  printf("%d\n", ans);
  return 0;
}
