#CCBCHHAI0000023. Số dương đạt ngưỡng (Positive Contributions to a Target)

Số dương đạt ngưỡng (Positive Contributions to a Target)

Positive Contributions to a Target

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given a positive target TT and a stream of positive integer contributions, start with cumulative total zero and receive contributions in their given order. Find the minimum number of initial contributions whose sum is at least TT. Stop immediately upon reaching the target.

Input

The first integer is the target TT. It is followed by positive contributions, separated by whitespace. The target is first reached after reading the final contribution; no additional value follows.

Output

Print one integer: the smallest number of contributions needed to reach or exceed TT.

Subtasks

  • Subtask 1 (20%): 1≤T≤1001\le T\le100; at most 55 contributions, each in [1,100][1,100].
  • Subtask 2 (30%): 1≤T≤1061\le T\le10^6; at most 100100 contributions, each in [1,106][1,10^6].
  • Subtask 3 (50%): 1≤T≤10121\le T\le10^{12}; at most 100000100000 contributions, each in [1,109][1,10^9].

Examples

Example 1

Input

12
3 4 5

Output

3

Explanation

Totals after contributions are 3, 7 and 12. The target 12 is first reached at contribution three.

Example 2

Input

5
9

Output

1

Explanation

The first contribution 9 already exceeds 5, so exactly one contribution is needed.