package yukiCoder; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No00143 { public static void main(String[] args) { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); String[] input1 = new String[3]; try { input1 = bufferedReader.readLine().split(" "); int[] input2 = new int[Integer.parseInt(input1[2])]; input2 = toIntArray(bufferedReader.readLine().split(" ")); int fullBeans = Integer.parseInt(input1[0]) * Integer.parseInt(input1[1]); System.out.println(eatFamily(fullBeans, input2)); } catch (IOException e) { e.printStackTrace(); } } public static int[] toIntArray(String[] stringArray) { int[] intArray = new int[stringArray.length]; for (int i = 0 ; i < stringArray.length ; i++) { intArray[i] = Integer.parseInt(stringArray[i]); } return intArray; } public static int eatFamily(int fullBeans, int[] ageArray) { for (int i = 0 ; i < ageArray.length ; i++) { fullBeans -= ageArray[i]; if (Integer.signum(fullBeans) == -1) { return -1; } } return fullBeans; } }