you = int(input()) retu = input() hairetu = [] zenbu = input().split() for i in zenbu: hairetu.append(int(i)) hairetu.reverse() count = 0 overall = 0 while count < you: i = 0 count += hairetu[i] overall += 1 i += 1 print(overall)