Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/ochkoz-massivni-toldirish

Patching an array

Hard 1000 ms 128 MB 95%
Share

$n$ positive integers in non-decreasing order and a positive integer $N$ are given. You may add some more positive integers to the array. The goal: every integer from $1$ to $N$ must be obtainable as a sum of some elements of the array (each element used at most once). What is the smallest number of numbers that must be added?

Array elements and the range from 1 to N covered by sums; the added numbers are highlighted

Input

The first line contains two positive integers: $n$ and $N$. The second line contains $n$ positive integers $a_{i}$ in non-decreasing order.

Output

One integer — the smallest number of numbers to add.

Note

$1 \le n \le 10^{5}$
$1 \le N \le 10^{18}$
$1 \le a_{1} \le a_{2} \le \dots \le a_{n} \le 10^{9}$

Examples

Input #1
3 20
1 5 10
Output #1
2
Input #2
2 3
1 2
Output #2
0

Sign in to submit a solution

Signing up is free and takes a minute.