a=[int(i) for i in input().split()] b=[int(i) for i in input().split()] c=a[0]*a[1] d=0 for i in b: d+=i if c-d<0: print("-1") else: print(c-d)