#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define FOR(i, n, m) for (ll i = (n); i < (m); ++i)
#define FORR(i, n, m) for (ll i = (m) - 1; i >= (n); --i) 
#define FORE(x, xs) for (auto &x: (xs))
#define ALL(v) v.begin(), v.end()
#define ZERO(a) memset(a,0,sizeof(a))

const int INF = 1000000009;
const int MOD = 1000000007;
const double EPS = 1e-14;
const double PI = acos(-1);

const int MAX = 410;
int N, C;
ll A[MAX], B[MAX];
ll dp[MAX][MAX];// dp[i][k]: i人決定していて、k個配っている


int main() {
    /*
     * A[i] = B[i]のケースのみ
     * */
    cin >> N >> C;
    REP (i, N) cin >> A[i];
    REP (i, N) cin >> B[i];

    dp[0][0] = 1;
    REP (i, N) {
        REP (j, C+1) {
            ll r = 1; // r = A[i]^(j-k)
            REPR (k, j+1) {
                (dp[i+1][j] += dp[i][k] * r) %= MOD;
                (r *= A[i]) %= MOD;
            }
        }
    }

    /*
    REP (i, N+1) {
        REP (j, C+1) cout << dp[i][j] << " ";
        cout << "\n";
    }
    */

    cout << dp[N][C] << endl;
}