import java.io.BufferedReader; import java.io.InputStreamReader; public class No156 { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader( System.in)); String[] nm = br.readLine().split(" "); int N = Integer.parseInt(nm[0]); int M = Integer.parseInt(nm[1]); String[] CStr = br.readLine().split(" "); int[] C = new int[N]; for (int i = 0; i < N; i++) { C[i] = Integer.parseInt(CStr[1]); } int emptyCount = 0; for (int i = 0; i < C.length; i++) { if (C[i] <= M) { M = M - C[i]; emptyCount++; } else { break; } } System.out.println(emptyCount); } catch (Exception e) { System.err.println("Error:" + e.getMessage()); } } }