import sys input = sys.stdin.readline N, M = map(int, input().split()) V = list(map(int, input().split())) R = list(map(int, input().split())) A, B = map(int, input().split()) dp1 = [[0]*(10**5+1) for _ in range(N+1)] dp2 = [[0]*(10**5+1) for _ in range(M+1)] dp1[0][0] = 1 dp2[0][0] = 1 MOD = 10**9+7 for i in range(N): for j in range(10**5+1): dp1[i+1][j] += dp1[i][j] dp1[i+1][j] %= MOD if j+V[i]<=10**5: dp1[i+1][j+V[i]] += dp1[i][j] dp1[i+1][j+V[i]] %= MOD acc = [0] for i in range(10**5+1): acc.append(acc[-1]+dp1[N][i]) for i in range(N): for j in range(10**5+1): dp2[i+1][j] += dp2[i][j] dp2[i+1][j] %= MOD if j+R[i]<=10**5: dp2[i+1][j+R[i]] += dp2[i][j] dp2[i+1][j+R[i]] %= MOD ans = 0 for i in range(1, 10**5+1): if i*A<=10**5: ans += dp2[M][i]*(acc[min(10**5, i*B)+1]-acc[i*A]) ans %= MOD print(ans)