import java.util.Scanner; class sampleA { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int l = scan.nextInt(); int n = scan.nextInt(); int sumW = 0; for (int i = 0; i <= n; i++) { int w = scan.nextInt(); if (sumW + w <= l) { sumW += w; } else { System.out.print(i); break; } } } }