Cassette

You have a cassette with tt seconds of length, and nn songs with lengths d1,d2,,dnd_1, d_2, \dots, d_n. Your aim is to store the maximal number of whole songs in the cassette. You must consider that songs must be recorded with a second of separation between them.

Input

The input consists of a series of cases separated with a line in white. Each case consists of two lines: The first one has tt and nn. The second one has nn numbers: d1,d2,,dnd_1, d_2, \dots, d_n. You can assume 1t1081 \le t \le 10^8, n1n \ge 1, and that for each ii, 1di1061 \le d_i \le 10^6.

Output

For each case of the input, your program must print the maximal number of whole songs that fit in the cassette, bearing that they must be separated by a second in mind.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:26:21.105Z

© Jutge.org, 2006–2026.
https://jutge.org