//Nayeem Shahriar Joy,Applied Physics & Electronic Engineering, University of Rajshahi.
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Joy{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int i=0;
String s=in.nextLine();
String[]values=s.split(" ");
int a=Integer.parseInt(values[1]);
String d=in.nextLine();
String[]joy=d.split(" ");
int sum=0;
int count=0;
for( i=0;i<joy.length;i++)
{
int b=Integer.parseInt(joy[i]);
a=a-b;
if(a>=0) {
count++;
}
else
{
break;
}
}
System.out.println(count);
}
}
No comments:
Post a Comment