Bee

5

1 votes
Problem

There is a bee which consumes N units of nectar to give birth to offsprings. There are K flowers present in a garden and the amount of nectar available in each flower is given in an array a, where a[i] is the nectar available in flower i. You have to find the number of the day on which the bee reproduces. If a bee gets the desired amount of nectar on ith day, then it reproduces on that day itself else it continues to consume nectar coming days until it gets the desired amount. Each flower is renewed with the nectar every day(the nectar for ith flower remains the same for all days).

Input

The first line contains two space separated Integers N and K denoting desired units of nectar and number of flowers respectively.

The second line contains K space separated integers i.e. elements of array a where a[i] denotes the amount of nectar available in flower i.

Constraints

  • 1N1018
  • 1K105
  • 1a[i]105

Output

Print an integer denoting the number of day on which the Bee produces offsprings.

Time Limit: 3
Memory Limit: 256
Source Limit:
Editor Image

?