You are given an array A, consisting of N integers and an array B, consisting of M integers.
The subsequence of A is the array that can be obtained by picking the elements at the arbitrary sorted set of positions from A.
Your task is to count the number of such subsequences C of A that:

- C contains exactly M elements.
- The array (C+B) is non-decreasing. Here by + operation, we mean element-wise sum. 

For example, the array (4, 8, 5) plus the array (10, 20, 30) is (14, 28, 35).

Formally, (C+B) is an array of size M such that (C+B)i = Ci + Bi.

In case some subsequence appears more that once, you should counts it as many times as it appears.

Formally, two subarrays of an array a, (ai_1, ai_2, ... ,ai_n) and (aj_1, aj_2, ... ,aj_m) will be considered different if either their lengths are different i.e. n != m or there exists an index k such that such that i_k  != j_k.

Since the answer can be very large, we ask you to calculate it, modulo 109+7.

-----Input-----
The first line of input contains a pair of space separated integers N and M, denoting the number of elements in the array A and the number of elements in the array B.
The second line contains N space-separated integers Ai, denoting the array A.
The third line contains M space-separated integers Bj, denoting the array B.

-----Output-----
Output a single line containing the number of subsequences C as asked in the problem, modulo 109+7.

-----Constraints-----
- 1 ≤ Ai, Bi ≤ 109
- 1 ≤ M ≤ N

-----Subtasks-----
- Subtask #1 (33 points): 1 ≤ N ≤ 50, 1 ≤ M ≤ 5
- Subtask #2 (33 points): 1 ≤ N ≤ 500, 1 ≤ M ≤ 50
- Subtask #3 (34 points): 1 ≤ N ≤ 2000, 1 ≤ M ≤ 1000

-----Example-----
Input #1:
5 3
1 5 2 4 7
7 9 6

Output #1:
4

Input #2:
4 2
7 7 7 7
3 4

Output #2:
6

-----Explanation-----
Example case 1. The suitable subsequences are (1, 2, 7), (1, 4, 7), (5, 4, 7), (2, 4, 7).
Example case 2. The suitable subsequence is (7, 7), and it appears 6 times:

- at indices (1, 2)
- at indices (1, 3)
- at indices (1, 4)
- at indices (2, 3)
- at indices (2, 4)
- at indices (3, 4)

So, the answer is 6.

Difficulty: competition

Starter code:

Solutions:
mod =(10**9)+7
n,m = list(map(int,input().split()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
dp = []
for i in range(n):
    dp += [[0]*m]
dp[-1][-1]=1
for i in range(n-2,-1,-1):
    dp[i][-1]=1
    for j in range(m-1):
        x = (a[i]+b[j])-(b[j+1])
        temp = 0
        for k in range(i+1,n):
            if(a[k]>=x):
                temp += dp[k][j+1]
        dp[i][j]=temp
ans = 0
for i in range(n):
    ans += dp[i][0]
print(ans%mod)
        


n,m = list(map(int,input().split()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
dp = []
for i in range(n):
    dp += [[0]*m]
dp[-1][-1]=1
for i in range(n-2,-1,-1):
    dp[i][-1]=1
    for j in range(m-1):
        x = (a[i]+b[j])-(b[j+1])
        temp = 0
        for k in range(i+1,n):
            if(a[k]>=x):
                temp += dp[k][j+1]
        dp[i][j]=temp
ans = 0
for i in range(n):
    ans += dp[i][0]
print(ans)