N,X = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) import sys flag = False for a in A: if a >= X: flag = True break if not flag: print(-1) exit() now = 0 C = [] D = [] for i in range(N): now += A[i] - X if A[i] < X: C.append(X-A[i]) D.append(B[i]) if now >= 0: print(0) exit() now = -now inf = 10 ** 8 N = len(D) dp = [[inf] * (now+1) for _ in range(N)] A = C B = D dp[0][min(now,A[0])] = B[0] dp[0][0] = 0 for i in range(N-1): for j in range(now+1): dp[i+1][j] = min(dp[i+1][j],dp[i][j]) dp[i+1][min(now,j+A[i+1])] = min(dp[i+1][min(now,j+A[i+1])],dp[i][j] + B[i+1]) print(dp[-1][-1])