408154: GYM103029 A John and nuts
Description
John decided to eat nuts. He has $$$x$$$ nuts in a box. There are $$$n$$$ types of nuts in the box. The box contains $$$a_i$$$ nuts of i-th type.
John wants to eat only one nut, but this nut must be one of the $$$k$$$ defined types – $$$b_1, b_2, \ldots b_k$$$.
John starts taking nuts out of the box blindly. What's the minimum amount of nuts that John must take to guarantee in this 'taken' nuts, John will find the type, that he would like to eat?
InputThe first line contains two integers $$$n, x$$$: $$$(1 \le n \le 10^5, 1 \le x \le 10^7)$$$.
The second line contains an array $$$a$$$ with $$$n$$$ integers: ($$$1 \le a_i \le x$$$). Note that $$$a_1 + a_2 + \ldots + a_n = x$$$.
The third line contains one integer $$$1 \le k \le n$$$.
The fourth line contains an array $$$b$$$ with $$$k$$$ different integers: $$$1 \le b_i \le n$$$, where $$$b_i$$$ – $$$i$$$-th type of nuts that John wants to eat.
OutputOutput a single number $$$answer$$$ – how many nuts John needs to take at least to guarantee that he will take the type of nut he wants to eat.
ExampleInput5 19 9 1 2 3 4 2 2 4Output
16Note
In the first test, John cannot draw $$$15$$$ nuts, as it may happen that he will draw $$$9$$$ nuts of type $$$1$$$, $$$2$$$ nuts of type $$$3$$$, and $$$4$$$ nuts of type $$$5$$$. It can be shown that $$$16$$$ nuts will always be enough.