As Gerald, Alexander, Sergey and Gennady are already busy with the usual New Year chores, Edward hastily decorates the New Year Tree. And any decent New Year Tree must be decorated with a good garland. Edward has lamps of m colors and he wants to make a garland from them. That garland should represent a sequence whose length equals L. Edward's tree is n layers high and Edward plans to hang the garland so as to decorate the first layer with the first l1 lamps, the second layer — with the next l2 lamps and so on. The last n-th layer should be decorated with the last ln lamps, <image>

Edward adores all sorts of math puzzles, so he suddenly wondered: how many different ways to assemble the garland are there given that the both following two conditions are met: 

  1. Any two lamps that follow consecutively in the same layer should have different colors. 
  2. The sets of used colors in every two neighbouring layers must be different. We consider unordered sets (not multisets), where every color occurs no more than once. So the number of lamps of particular color does not matter. 



Help Edward find the answer to this nagging problem or else he won't manage to decorate the Tree by New Year. You may consider that Edward has an unlimited number of lamps of each of m colors and it is not obligatory to use all m colors. The garlands are considered different if they differ in at least one position when represented as sequences. Calculate the answer modulo p.

Input

The first line contains three integers n, m and p (1 ≤ n, m ≤ 106, 2 ≤ p ≤ 109) which are the number of the tree's layers, the number of the lamps' colors and module correspondingly. The next line contains n integers li (1 ≤ li ≤ 5000, <image>).

Output

Print the only integer — the number of garlands modulo p.

Examples

Input

3 2 1000
3 1 2


Output

8


Input

2 3 1000
2 2


Output

24


Input

1 1 1000
5


Output

0

Note

In the first sample the following variants are possible: 121|1|12, 121|1|21, 121|2|12, 121|2|21, 212|1|12, 212|1|21, 212|2|12, 212|2|21. In the second sample the following variants are possible: 12|13, 12|23, 12|31, 12|32 and so on. 

Figure for the first sample: <image>
#include <bits/stdc++.h>
using namespace std;
long long n, m, p, l[1000100], a[5050][5050], x[5050], y[5050], h[5050],
    f[5050];
void pre(void) {
  a[1][1] = 1;
  for (long long i = 2; i < 5050; ++i)
    for (long long j = 2; j <= i; ++j)
      a[i][j] = a[i - 1][j - 1] + (j - 1) * a[i - 1][j], a[i][j] %= p;
}
void read(void) {
  cin >> n >> m >> p;
  for (long long i = 0; i < n; ++i) cin >> l[i];
  h[0] = 1;
  f[0] = 1;
  for (long long i = 1; i < 5050; ++i)
    h[i] = (h[i - 1] * (m - i + 1)) % p, f[i] = (f[i - 1] * i) % p;
}
void kill(void) {
  long long s = 0;
  for (long long i = 1; i <= l[0]; ++i) x[i] = (a[l[0]][i] * h[i]) % p;
  for (long long i = 1; i <= l[0]; ++i) s += x[i], s %= p;
  for (long long i = 1; i < n; ++i) {
    for (long long j = 1; j <= l[i]; ++j) {
      y[j] = h[j] * s - f[j] * x[j];
      y[j] %= p;
      y[j] *= a[l[i]][j];
      y[j] %= p;
    }
    s = 0;
    for (long long j = 0; j <= l[i + 1]; ++j) x[j] = 0;
    for (long long j = 1; j <= l[i]; ++j) x[j] = y[j], s += x[j], s %= p;
  }
  s %= p;
  if (s < 0) s += p;
  cout << s << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  read();
  pre();
  kill();
  return 0;
}
