import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	int[] tmp = readln.chomp.split.map!(to!int).array;
	int n = tmp[0], c = tmp[1];
	int[] as = readln.chomp.split.map!(to!int).array;
	int[] bs = readln.chomp.split.map!(to!int).array;
	
	ulong mod = 1_000_000_007;
	
	ulong[][] dp; // dp[j][i] := j kids left, i candies left
	for(int j = 0; j <= n; j ++){
		dp ~= [0];
		dp[j].length = c + 2;
		for(int i = 0; i <= c; i ++){
			if(i == 0) dp[j][i] = 1;
			else if(j == 0) dp[j][i] = 0;
			else dp[j][i] = as[n - j] * dp[j][i - 1] + dp[j - 1][i];
			dp[j][i] %= mod;
			}
		}
	
	ulong ans = dp[n][c];
	ans.writeln;
	
	}