using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace No143Beans { class Program { static void Main(string[] args) { //豆、袋、人数の入力 string[] K = Console.ReadLine().Split(' '); int beans = int.Parse(K[0]); int pack = int.Parse(K[1]); int people = int.Parse(K[2]); //年齢の入力 string[] N = Console.ReadLine().Split(' '); //豆の総数 int allbeans = (beans * pack); //年齢の総数 int[] year = new int[people]; int years = 0; for (int i = 0; i < people; i++) { year[i] = int.Parse(N[i]); years += year[i]; } //豆の数のほうが多い場合 if (allbeans >= years) { //表示 Console.WriteLine(allbeans - years); } //年齢の数のほうが大きい場合 else if (years > allbeans) { //表示 Console.WriteLine("-1"); } } } }