INF = 1 << 60 n, x = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) for i in range(n): a[i] -= x if all([x < 0 for x in a]): print("-1") exit() cost = - sum(a) if cost <= 0: print("0") exit() dp = {} dp[0] = 0 ans = INF for i in range(n): if a[i] >= 0: continue ndp = {} for k, v in dp.items(): ndp[k] = min(ndp.get(k, INF), v) nxt = k - a[i] if nxt >= cost: ans = min(ans, v + b[i]) else: ndp[nxt] = min(ndp.get(nxt, INF), v + b[i]) dp = ndp print(ans)