#include <bits/stdc++.h>

using namespace std;

#define MAX 5050
typedef long long ll;
const ll MOD = ((1e9) + 7);

int dp[2][MAX];

int main()
{
    int N, L;
    cin >> N >> L;
    vector<int> x(N), a(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i]; 
    }
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    for (int i = 0; i < L; i++) {
        dp[0][i] = 1;
    }
    
    for (int i = 0; i < N; i++) {
        int curr = i & 1, next = !curr;
        for (int j = x[i]; j < L; j += a[i]) {
            if (j > 0) {
                dp[next][j] += dp[curr][j-1];
            } else {
                dp[next][j] = dp[curr][j];
            }
            dp[next][j] %= MOD;
            if (a[i] == 0) break;
        }
        
        for (int j = x[i]; j < L; j++) {
            dp[next][j+1] += dp[next][j];
            dp[next][j+1] %= MOD;
        }
        fill(dp[curr], dp[curr] + L, 0);
    }
    
    cout << dp[N&1][L-1] << endl;
    return 0;
}