13313 - Energy Gun   

Description

Samus Aran received an energy gun before her next mission. The energy gun is a very powerful weapon that uses integers to shoot. However there is one problem with the energy gun, there is an N second delay. If Samus inputs a list of numbers, she must wait N seconds before the weapon starts to shoot out the numbers.

To use it, Samus will input an integer into the gun every second for M seconds. Afterwards, each integer she inputs will remain inside the energy gun for N - 1 seconds and it will be outputted during the Nth second.

Help Samus understand the code for this weapon by writing the code down for her to read.

Input

The first line will contain 2 integers, N and M.

1<= N, M <= 50

N is the delay of the weapon.

M is the amount of seconds Samus will input integers.

The next line will contain M integers, the integers Samus will input into the code

Output

The output of the weapon followed by a newline character after M seconds.

If the gun makes no output, the output value will be 0.

Sample Input  Download

Sample Output  Download

Tags




Discuss