k, n, f = map(int, input().split()) a1, a2, a3 = map(int, input().split()) left = k * n - (a1 + a2 + a3) if left > 0: print(left) else: print(-1)