/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.*; /** * * @author tokio */ public class suuzi { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int L = scanner.nextInt(); int N = scanner.nextInt(); int[] W = new int[N]; int sum = 0; int count = 0; for(int i=0 ; i= sum){ // sum += W[i]; // i++; // } for(int i = 0 ; i < N ; i++){ if(L >= sum + W[i]){ sum += W[i]; count++; }else{ break; } } System.out.println(count); } }