N, M = map(int, input().split())
memories = list(map(int, input().split()))
costs = list(map(int, input().split()))

dp = dict() # key(memory): value(cost)

for i in range(N):
    memory = memories[i]
    cost = costs[i]
    
    tmp = []
    #print('d', len(dp))
    for j in dp:
        try:
            new_memory = memory + j
            new_cost = cost+dp[j]
            dp[new_memory] = min(dp[new_memory], new_cost)
        except:
            tmp.append([new_memory, new_cost])
    #print('l', len(tmp))
    for m, c in tmp:
        try:
            dp[m] = min(dp[m], c)
        except:
            dp[m] = c
    try:
        dp[memory] = min(dp[i], cost)
    except:
        dp[memory] = cost

result = int(1e9)

for i in dp:
    if(i >= M):
        result = min(result, dp[i])
print(result)