We have a sequence A of N non-negative integers.
Compute the sum of \prod _{i = 1} ^N \dbinom{B_i}{A_i} over all sequences B of N non-negative integers whose sum is at most M, and print it modulo (10^9 + 7).
Here, \dbinom{B_i}{A_i}, the binomial coefficient, denotes the number of ways to choose A_i objects from B_i objects, and is 0 when B_i < A_i.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 2000
 - 1 \leq M \leq 10^9
 - 0 \leq A_i \leq 2000

-----Input-----
Input is given from Standard Input in the following format:
N M
A_1 A_2 \ldots A_N

-----Output-----
Print the sum of \prod _{i = 1} ^N \dbinom{B_i}{A_i}, modulo (10^9 + 7).

-----Sample Input-----
3 5
1 2 1

-----Sample Output-----
8

There are four sequences B such that \prod _{i = 1} ^N \dbinom{B_i}{A_i} is at least 1:
 - B = \{1, 2, 1\}, where \prod _{i = 1} ^N \dbinom{B_i}{A_i} = \dbinom{1}{1} \times \dbinom{2}{2} \times \dbinom{1}{1} = 1;
 - B = \{2, 2, 1\}, where \prod _{i = 1} ^N \dbinom{B_i}{A_i} = \dbinom{2}{1} \times \dbinom{2}{2} \times \dbinom{1}{1} = 2;
 - B = \{1, 3, 1\}, where \prod _{i = 1} ^N \dbinom{B_i}{A_i} = \dbinom{1}{1} \times \dbinom{3}{2} \times \dbinom{1}{1} = 3;
 - B = \{1, 2, 2\}, where \prod _{i = 1} ^N \dbinom{B_i}{A_i} = \dbinom{1}{1} \times \dbinom{2}{2} \times \dbinom{2}{1} = 2.
The sum of these is 1 + 2 + 3 + 2 = 8.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom fractions import Fraction\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations, accumulate\nfrom operator import add, mul, sub, itemgetter, attrgetter\n\n\nimport sys\n# sys.setrecursionlimit(10**6)\n# readline = sys.stdin.buffer.readline\nreadline = sys.stdin.readline\n\nINF = 1 << 60\n\n\ndef read_int():\n    return int(readline())\n\n\ndef read_int_n():\n    return list(map(int, readline().split()))\n\n\ndef read_float():\n    return float(readline())\n\n\ndef read_float_n():\n    return list(map(float, readline().split()))\n\n\ndef read_str():\n    return readline().strip()\n\n\ndef read_str_n():\n    return readline().strip().split()\n\n\ndef ep(*args):\n    print(*args, file=sys.stderr)\n\n\ndef epp(o):\n    import pprint\n    pprint.pprint(o, stream=sys.stderr)\n\ndef gen_2d_array(n, m, fill=0):\n    if callable(fill):\n        return [[fill()] * m for _ in range(n)]\n    else:\n        return [[fill] * m for _ in range(n)]\n\n\ndef gen_3d_array(n, m, k, fill=0):\n    if callable(fill):\n        return [[[fill()] * k for _ in range(m)] for _ in range(n)]\n    else:\n        return [[[fill] * k for _ in range(m)] for _ in range(n)]\n\n\ndef mt(f):\n    import time\n\n    def wrap(*args, **kwargs):\n        s = time.perf_counter()\n        ret = f(*args, **kwargs)\n        e = time.perf_counter()\n\n        ep(e - s, 'sec')\n        return ret\n\n    return wrap\n\n\n@mt\ndef slv(N, M, A):\n    mod = 10**9 + 7\n    S = sum(A)\n    a = 1\n    b = 1\n    for i in range(1, N+S+1):\n        a *= i\n        a %= mod\n        b *= M+N-i+1\n        b %= mod\n\n    return b * pow(a, mod-2, mod) % mod\n\n\n\ndef main():\n    N, M = read_int_n()\n    A = read_int_n()\n    print(slv(N, M, A))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 16855