n, x = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) ab = [(a, b) for a, b in zip(A, B)] ab.sort(reverse = True) ans = 0 tot = 0 lst = [] for a, b in ab: if a >= x: ans += b tot += a - x else: lst.append((x - a, b)) if ans == 0: print(-1) exit() dp = [0] * (tot + 1) for a, b in lst: for i in range(tot, a - 1, -1): dp[i] = max(dp[i], dp[i - a] + b) ans += dp[-1] print(sum(B) - ans)