Killjee and songs

0

0 votes
Easy
Problem

Killjee has N songs in his player. Initial volume of his player is X and highest volume Killjee can hear is Y, After playing ith song killjee can increase the volume of player by Ai.

Can you tell killjee what maximum volume he can achieve without hurting his ears.

INPUT

First line of input contains 3 space separated integer X, Y, N. Second line contains N space separated integers ith of which is Ai.

OUTPUT

Print highest volume that can be achieved.

CONSTRAINTS

1X,Y,Ai105

XY

1N103

Sample Input
2 3 2
3 2
Sample Output
2
Time Limit: 1
Memory Limit: 1024
Source Limit:
Explanation

we can't increase volume in any step.

Editor Image

?