#C4053. Find the Missing Rating
Find the Missing Rating
Find the Missing Rating
You are given a total of \(n\) photos, and the sum of the ratings of all photos is \(S\). However, you only remember the ratings of \(n-1\) photos. Your task is to determine the rating of the missing photo.
Formally, let \(a_1, a_2, \dots, a_{n-1}\) be the remembered ratings. The rating of the missing photo is given by:
[ \text{missing} = S - \sum_{i=1}^{n-1} a_i ]
It is guaranteed that the input values are such that the missing rating is a non-negative integer.
inputFormat
The input is read from standard input (stdin) and consists of two lines. The first line contains two space-separated integers \(n\) and \(S\), where \(n\) is the total number of photos and \(S\) is the sum of all ratings. The second line contains \(n-1\) space-separated integers representing the remembered ratings.
outputFormat
Output a single integer representing the missing rating. The output should be written to standard output (stdout).
## sample5 15
3 2 6 1
3