import sys input = sys.stdin.readline mod=998244353 N,K=map(int,input().split()) C=list(map(int,input().split())) D=list(map(int,input().split())) DP=[[0,0] for i in range(K+1)] DP[0]=[0,1] MAX=0 ANS=0 for i in range(K+1): if DP[i]!=[0,0]: for j in range(N): c,d=C[j],D[j] if i+c<=K: if DP[i+c][0]