using System; using System.Collections.Generic; using System.Linq; class Program { static string InputPattern = "Input2"; static List GetInputList() { var WillReturn = new List(); if (InputPattern == "Input1") { WillReturn.Add("10 10 3"); WillReturn.Add("10 20 40"); //30 } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { List InputList = GetInputList(); int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray(); int K = wkArr[0]; int N = wkArr[1]; int[] AArr = InputList[1].Split(' ').Select(X => int.Parse(X)).ToArray(); int RestCnt = K * N - AArr.Sum(); Console.WriteLine(RestCnt >= 0 ? RestCnt : -1); } }