Partial Transmission

시간 제한1초메모리 제한2048 MB

요약
n, p와 p 이상 p+n-1 이하의 서로 다른 n-1개 값이 주어질 때 빠진 값을 찾는다.
난이도

쉬움10점 중 3점

유형
수학, 해시맵
정답자
아직 제출이 없습니다

문제

Maria works for the government helping catch spies. She listens to radio transmissions that occur every hour and attempts to decrypt numbers from the transmission to determine the location of the spy.

She has figured out a pattern with one frequency she listens to: the transmission starts out with a integer nn, the next integer is a integer pp, and then a sequence of integers SS follows with nn unique integers. The smallest integer in this sequence is pp, and all integers in the sequence are always less than p+np + n.

Today, the last integer in the transmission is being cut off by her faulty receiver, but she believes that she can discover this number using a computer program. Write Maria a program which tells her the missing integer.

입력

The first line of input consists of the integer nn (2≤n<1002 \le n < 100).

The next line of input consists of the integer pp (0≤p<1,0000 \le p < 1\\,000).

The third and last line of input consists of the sequence SS with the last integer missing.

출력

Output the missing integer on its own line.

예제2

  1. 예제 1

    입력
    6
    3
    4 3 8 7 6
    
    예상 출력
    5
    
  2. 예제 2

    입력
    10
    1
    1 2 3 4 5 6 7 8 9
    
    예상 출력
    10