n, x = [int(i) for i in input().split()] a = [int(i)-x for i in input().split()] b = [int(i) for i in input().split()] if all(map(lambda x: x < 0, a)): print(-1) exit() sum_a = sum(a) if sum_a >= 0: print(0) exit() sum_a *= -1 dp = [10 ** 8] * (sum_a+1) dp[0] = 0 for index, score in enumerate(a): if score >= 0: continue for i in reversed(range(sum_a)): j = min(sum_a, i - score) dp[j] = min(dp[j], dp[i] + b[index]) print(dp[-1])