main :: IO () main = do -- Read the first line and parse K, N, and F firstLine <- getLine let [k, n, f] = map read (words firstLine) :: [Int] -- Read the second line and parse the ages secondLine <- getLine let ages = map read (words secondLine) :: [Int] -- Calculate total beans available and total beans required let totalBeans = k * n let requiredBeans = sum ages -- Calculate the remaining beans let leftover = totalBeans - requiredBeans -- Output -1 if there are not enough beans, otherwise output the leftover if leftover < 0 then print (-1) else print leftover