Problem:
Score : 200 points

Problem Statement

A ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \leq i \leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.

How many times will the ball make a bounce where the coordinate is at most X?

Constraints

1 \leq N \leq 100

1 \leq L_i \leq 100

1 \leq X \leq 10000

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N X
L_1 L_2 ... L_{N-1} L_N

Output

Print the number of times the ball will make a bounce where the coordinate is at most X.

Sample Input 1

3 6
3 4 5

Sample Output 1

2

The ball will make a bounce at the coordinates 0, 3, 7 and 12, among which two are less than or equal to 6.

Sample Input 2

4 9
3 3 3 3

Sample Output 2

4

The ball will make a bounce at the coordinates 0, 3, 6, 9 and 12, among which four are less than or equal to 9.

Solution in C (GCC 5.4.1) (judge verdict: Accepted)

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include <string.h>



/*以下便利なマクロを定義する。*/

#define MAX_INT 2147483647
#define MIN_INT -2147483648

#define rep(i, min, max) for(i=min; i<=max; i=i+1)



#define if_forall(i, min, max, prop)\
\
	rep(i, min, max)\
	{\
		if(!(prop))\
		{\
			break;\
		}\
	}\
\
	if(i==max+1)\



#define if_exists(i, min, max, prop)\
\
	rep(i, min, max)\
	{\
		if(prop)\
		{\
			break;\
		}\
	}\
\
	if(i<max+1)\



#define sum(i, min, max, sequence, answer)\
{\
	answer=0;\
	rep(i, min, max)\
	{\
		answer=answer+sequence;\
	}\
}\



#define prod(i, min, max, sequence, answer)\
{\
	answer=1;\
	rep(i, min, max)\
	{\
		answer=answer*sequence;\
	}\
}\











/*以下便利な関数を定義する。*/

void fill_int(int array[], int min, int max, int element)
{
	int i=min;

	rep(i, min, max)
	{
		array[i]=element;
	}

}



void fill_int_array(int size_1, int size_2, int array[size_1][size_2], int i_min, int i_max, int j_min, int j_max, int element)
{
	int i=i_min;

	rep(i, i_min, i_max)
	{
		fill_int(array[i], j_min, j_max, element);
	}
}



void fill_char(char array[], int min, int max, char element)
{
	int i=min;

	rep(i, min, max)
	{
		array[i]=element;
	}

}



void fill_char_array(int size_1, int size_2, char array[size_1][size_2], int min, int max, char element[])
{
	int i=min, j=0;

	rep(i, min, max)
	{
		fill_char(array[i], 0, size_2-2, '\0');
		for(j=0; j<strlen(element); j=j+1)
		{
			array[i][j]=element[j];
		}
	}
}



void  swap_int(int* x, int* y)
{
    int  tmp;

    tmp = *x;
    *x = *y;
    *y = tmp;
}



void  swap_int_array(int x[], int y[], int min, int max)
{
	int i;

    rep(i, min, max)
	{
		swap_int(&x[i], &y[i]);
	}
}



void  swap_char(char* x, char* y)
{
    char  tmp;

    tmp = *x;
    *x = *y;
    *y = tmp;
}



void  swap_char_array(char x[], char y[], int min, int max)
{
	int i;

    rep(i, min, max)
	{
		swap_char(&x[i], &y[i]);
	}
}



void reverse_char(char array[], int min, int max)
{
	int i;

	rep(i, min, (min+max)/2)
	{
		swap_char(&array[i], &array[min+max-i]);
	}
}



int max_int(int var1, int var2)
{
	int answer=var1;

	if(answer<var2)
	{
		answer=var2;
	}

	return answer;
}



int min_int(int var1, int var2)
{
	int answer=var1;

	if(answer>var2)
	{
		answer=var2;
	}

	return answer;
}



double max_double(double var1, double var2)
{
	double answer=var1;

	if(answer<var2)
	{
		answer=var2;
	}

	return answer;
}



double min_double(double var1, double var2)
{
	double answer=var1;

	if(answer>var2)
	{
		answer=var2;
	}

	return answer;
}



long int pow_int(int base, unsigned int exponent)
{
	long int answer=1;

	answer=(long int)pow((double)base, (double)exponent);

	return answer;
}



long int pow_int_mod(int base, unsigned int exponent, int mod)
{
	long int answer=1;
	while (exponent>0)
	{
		if (exponent&1)
		{
			answer=(answer*(base%mod))%mod;
			if(answer==0)
			{
				break;
			}
		}
		base=(base*base)%mod;
		exponent=exponent>>1;
	}
	return answer;
}



unsigned long int factorial(unsigned int num)
{
	unsigned int i=0;
	unsigned long int answer=1;
	rep(i, 2, num)
	{
		answer=answer*i;
	}
	return answer;
}



unsigned long int factorial_mod(unsigned int num, int mod)
{
	unsigned int i=0;
	unsigned long int answer=1;
	rep(i, 2, num)
	{
		answer=(answer*(i%mod))%mod;
		if(answer==0)
		{
			break;
		}
	}
	return answer;
}



unsigned long int combination(unsigned int n, unsigned int k)
{
	unsigned int i=0;
	unsigned long int numerator=1;
	unsigned long int denominator=1;

	k=min_int(k, n-k);

	rep(i, 2, k)
	{
		numerator=numerator*(n+1-i);
		denominator=denominator*i;
	}
	return numerator/denominator;
}



double combination_general(double alpha, unsigned int k)
{
	unsigned int i;
	double numerator=1;
	unsigned long int denominator=1;

	rep(i, 1, k)
	{
		numerator=numerator*(alpha+1-i);
		denominator=denominator*i;
	}
	return numerator/denominator;
}



int gcd(int a, int b)
{
	if(a<b)
	{
		swap_int(&a, &b);
	}

	int r=a%b;

	while(r!=0)
	{
		a=b;
		b=r;
		r=a%b;
	}

	return b;
}



int lcm(int a, int b)
{
	return (a/gcd(a, b))*b;
}



int order(long int num)
{
	int answer=-1;
	while(num!=0)
	{
		num=num/10;
		answer=answer+1;
	}
	return answer;
}



long int convert_adic_int(char num[], unsigned int p_adic, unsigned int q_adic)
{
	int i=0;
	long int answer=0;
	bool sgn=0;
	long int tmp=strtol(num, NULL, p_adic);

	if(tmp<0)
	{
		sgn=1;
		tmp=-tmp;
	}

	while(tmp>0)
	{
		answer=answer+(tmp%q_adic)*pow_int(10, i);
		tmp=tmp/q_adic;
		i=i+1;
	}

	if(sgn==0)
	{
		return answer;
	}
	else
	{
		return -answer;
	}
}



void convert_adic_char(char num[], unsigned int p_adic, unsigned int q_adic)
{
	int i=0;
	int mod[32]={0};
	bool sgn=0;
	int digit=0;
	long int tmp=strtol(num, NULL, p_adic);

	if(tmp<0)
	{
		sgn=1;
		tmp=-tmp;
	}

	while(tmp>0)
	{
		mod[i]=tmp%q_adic;

		digit=i;
		tmp=tmp/q_adic;
		i=i+1;
	}

	fill_char(num, 0, min_int(0, strlen(num)-1), '\0');

	if(sgn==1)
	{
		num[0]='-';
	}

	rep(i, 0, digit)
	{
		if(mod[i]<10)
		{
			num[sgn+digit-i]='0'+mod[i];
		}
		else if(mod[i]<q_adic)
		{
			num[sgn+digit-i]='a'+(mod[i]-10);
		}
	}
}



int sum_digit(int num)
{
	int answer=0;
	num=abs(num);

	while(num>0)
	{
		answer=answer+num%10;
		num=num/10;
	}
	return answer;
}



int count_mod(int min, int max, int num)
{
	if(min>0)
	{
		return max/num-(min-1)/num;
	}
	else if(min==0)
	{
		return max/num+1;
	}
	else
	{
		return -1;
	}
}



void shift_char(char array[], int min, int max, int num)
{
	int i;
	int l=strlen(array);

	if(num>0)
	{
		max=min_int(max, l-num-1);

		for(i=max; i>=min; i=i-1)
		{
			array[i+num]=array[i];
		}

		for(i=min; i<=min+num-1; i=i+1)
		{
			array[i]='\0';
		}
	}
	else if(num<0)
	{
		min=max_int(min, -num);

		for(i=min; i<=max; i=i+1)
		{
			array[i+num]=array[i];
		}

		for(i=max+num+1; i<=max; i=i+1)
		{
			array[i]='\0';
		}
	}
}



void shift_int_array(int size, int array[size], int min, int max, int num)
{
	int i;

	if(num>0)
	{
		max=min_int(max, size-num-1);

		for(i=max; i>=min; i=i-1)
		{
			array[i+num]=array[i];
		}

		for(i=min; i<=min+num-1; i=i+1)
		{
			array[i]=0;
		}
	}
	else if(num<0)
	{
		min=max_int(min, -num);

		for(i=min; i<=max; i=i+1)
		{
			array[i+num]=array[i];
		}

		for(i=max+num+1; i<=max; i=i+1)
		{
			array[i]=0;
		}
	}
}



void convert_char(char array[], int min, int max, char pre, char post)
{
	int i=min;

	rep(i, min, max)
	{
		if(array[i]==pre)
		{
			array[i]=post;
		}
	}
}



void sort_asc_int(int array[], int min, int max)
{
	int i, j;

	rep(i, min, max)
	{
		rep(j, i+1, max)
		{
			if(array[i]>array[j])
			{
				swap_int(&array[i], &array[j]);
			}
		}
	}
}



void sort_des_int(int array[], int min, int max)
{
	int i, j;

	rep(i, min, max)
	{
		rep(j, i+1, max)
		{
			if(array[i]<array[j])
			{
				swap_int(&array[i], &array[j]);
			}
		}
	}
}



void sort_asc_char_dic(char array[], int min, int max)
{
	int i, j;

	rep(i, min, max)
	{
		rep(j, i+1, max)
		{
			if(strcmp(&array[i], &array[j])>0)
			{
				swap_char(&array[i], &array[j]);
			}
		}
	}
}



void sort_asc_char_array_dic(int size_1, int size_2, char array[size_1][size_2], int min, int max)
{
	int i, j;

	rep(i, min, max)
	{
		rep(j, i+1, max)
		{
			if(strcmp(array[i], array[j])>0)
			{
				swap_char_array(array[i], array[j], 0, size_2-1);
			}
		}
	}
}



void sort_des_char_dic(char array[], int min, int max)
{
	int i, j;

	rep(i, min, max)
	{
		rep(j, i+1, max)
		{
			if(strcmp(&array[i], &array[j])<0)
			{
				swap_char(&array[i], &array[j]);
			}
		}
	}
}



void sort_des_char_array_dic(int size_1, int size_2, char array[size_1][size_2], int min, int max)
{
	int i, j;

	rep(i, min, max)
	{
		rep(j, i+1, max)
		{
			if(strcmp(array[i], array[j])<0)
			{
				swap_char_array(array[i], array[j], 0, size_2-1);
			}
		}
	}
}



int max_int_array(int array[], int min, int max)
{
	int i;
	int answer;

	answer=array[min];

	rep(i, min+1, max)
	{
		answer=max_int(answer, array[i]);
	}

	return answer;
}



void max_int_array_num(int array[], int min, int max, int answer[])
{
	int i, j;
	int count=0;

	fill_int(answer, 0, max-min, -1);

	rep(i, min, max)
	{
		count=0;
		rep(j, min, max)
		{
			if(array[i]<array[j])
			{
				count=count+1;
			}
		}
		j=0;
		while(answer[count+j]!=-1)
		{
			j=j+1;
		}
		answer[count+j]=i;
	}
}



void max_int_array_table(int array[], int min, int max, int size_1, int size_2, int answer[size_1][size_2])
{
	int i, j;
	int count=1;

	fill_int(answer[0], 0, size_2-1, 0);
	for(i=1; i<=size_1-1; i=i+1)
	{
		answer[i][0]=MIN_INT;
		fill_int(answer[i], 1, size_2-1, -1);
	}



	int copy[max-min+1];
	for(i=0; i<=max-min; i=i+1)
	{
		copy[i]=array[i+min];
	}

	sort_des_int(copy, 0, max-min);

	answer[1][0]=copy[0];

	i=1;
	count=2;
	while(i<=max-min)
	{
		if(copy[i]!=answer[count-1][0])
		{
			answer[count][0]=copy[i];
			count=count+1;
		}
		i=i+1;
	}
	answer[0][0]=count-1;



	for(j=1; j<=answer[0][0]; j=j+1)
	{
		count=0;
		for(i=min; i<=max; i=i+1)
		{
			if(array[i]==answer[j][0])
			{
				count=count+1;
				answer[j][count]=i;
			}
		}
		answer[0][j]=count;
	}
}



int max_int_whatnumber(int array[], int min, int max, int num)
{
	int i;
	int ans=1;

	for(i=min; i<=max; i=i+1)
	{
		if(array[num]<array[i])
		{
			ans=ans+1;
		}
	}
	return ans;
}




int min_int_array(int array[], int min, int max)
{
	int i;
	int answer;

	answer=array[min];

	rep(i, min+1, max)
	{
		answer=min_int(answer, array[i]);
	}

	return answer;
}



void min_int_array_num(int array[], int min, int max, int answer[])
{
	int i, j;
	int count=0;

	fill_int(answer, 0, max-min, -1);

	rep(i, min, max)
	{
		count=0;
		rep(j, min, max)
		{
			if(array[i]>array[j])
			{
				count=count+1;
			}
		}
		j=0;
		while(answer[count+j]!=-1)
		{
			j=j+1;
		}
		answer[count+j]=i;
	}
}



void min_int_array_table(int array[], int min, int max, int size_1, int size_2, int answer[size_1][size_2])
{
	int i, j;
	int count=1;

	fill_int(answer[0], 0, size_2-1, 0);
	for(i=1; i<=size_1-1; i=i+1)
	{
		answer[i][0]=MAX_INT;
		fill_int(answer[i], 1, size_2-1, -1);
	}



	int copy[max-min+1];
	for(i=0; i<=max-min; i=i+1)
	{
		copy[i]=array[i+min];
	}

	sort_asc_int(copy, 0, max-min);

	answer[1][0]=copy[0];

	i=1;
	count=2;
	while(i<=max-min)
	{
		if(copy[i]!=answer[count-1][0])
		{
			answer[count][0]=copy[i];
			count=count+1;
		}
		i=i+1;
	}
	answer[0][0]=count-1;



	for(j=1; j<=answer[0][0]; j=j+1)
	{
		count=0;
		for(i=min; i<=max; i=i+1)
		{
			if(array[i]==answer[j][0])
			{
				count=count+1;
				answer[j][count]=i;
			}
		}
		answer[0][j]=count;
	}
}



int min_int_whatnumber(int array[], int min, int max, int num)
{
	int i;
	int ans=1;

	for(i=min; i<=max; i=i+1)
	{
		if(array[num]>array[i])
		{
			ans=ans+1;
		}
	}
	return ans;
}



double max_double_array(double array[], int min, int max)
{
	int i=min;
	double answer;

	answer=array[min];

	rep(i, min+1, max)
	{
		answer=max_double(answer, array[i]);
	}

	return answer;
}



double min_double_array(double array[], int min, int max)
{
	int i=min;
	double answer;

	answer=array[min];

	rep(i, min+1, max)
	{
		answer=min_double(answer, array[i]);
	}

	return answer;
}



int max_char_array_dic(int size_1, int size_2, char array[size_1][size_2], int min, int max)
{
	int i;
	int answer=min;

	rep(i, min+1, max)
	{
		if(strcmp(array[answer], array[i])<0)
		{
			answer=i;
		}
	}

	return answer;
}



void max_char_array_dic_num(int size_1, int size_2, char array[size_1][size_2], int min, int max, int answer[])
{
	int i, j;
	int count=0;

	fill_int(answer, 0, max-min, -1);

	for(i=min; i<=max; i=i+1)
	{
		count=0;
		for(j=min; j<=max; j=j+1)
		{
			if(strcmp(array[i], array[j])<0)
			{
				count=count+1;
			}
		}
		j=0;
		while(answer[count+j]!=-1)
		{
			j=j+1;
		}
		answer[count+j]=i;
	}
}



int max_char_whatnumber(int size_1, int size_2, char array[size_1][size_2], int min, int max, int num)
{
	int i;
	int ans=1;

	for(i=min; i<=max; i=i+1)
	{
		if(strcmp(array[num], array[i])<0)
		{
			ans=ans+1;
		}
	}
	return ans;
}



int min_char_array_dic(int size_1, int size_2, char array[size_1][size_2], int min, int max)
{
	int i;
	int answer=min;

	rep(i, min+1, max)
	{
		if(strcmp(array[answer], array[i])>0)
		{
			answer=i;
		}
	}

	return answer;
}



void min_char_array_dic_num(int size_1, int size_2, char array[size_1][size_2], int min, int max, int answer[])
{
	int i, j;
	int count=0;

	fill_int(answer, 0, max-min, -1);

	for(i=min; i<=max; i=i+1)
	{
		count=0;
		for(j=min; j<=max; j=j+1)
		{
			if(strcmp(array[i], array[j])>0)
			{
				count=count+1;
			}
		}
		j=0;
		while(answer[count+j]!=-1)
		{
			j=j+1;
		}
		answer[count+j]=i;
	}
}



int min_char_whatnumber(int size_1, int size_2, char array[size_1][size_2], int min, int max, int num)
{
	int i;
	int ans=1;

	for(i=min; i<=max; i=i+1)
	{
		if(strcmp(array[num], array[i])>0)
		{
			ans=ans+1;
		}
	}
	return ans;
}



int sum_array(int array[], int min, int max)
{
	int i=min;
	int answer=0;

	rep(i, min, max)
	{
		answer=answer+array[i];
	}

	return answer;
}



bool detect_int(int array[], int min, int max, int element)
{
	int i;
	bool answer=0;

	if_exists(i, min, max, array[i]==element)
	{
		answer=1;
	}

	return answer;
}



bool detect_char(char array[], int min, int max, char element)
{
	int i;
	bool answer=0;

	if_exists(i, min, max, array[i]==element)
	{
		answer=1;
	}
	return answer;
}



bool detect_char_array(char array[], int min, int max, char element[], int start, int goal)
{
	int i, j;
	bool answer=0;

	if(goal-start<=max-min)
	{
		rep(i, min, max-(goal-start))
		{
			if_forall(j, start, goal, array[i+j-start]==element[j])
			{
				answer=1;
				break;
			}
		}
	}

	return answer;
}




int count_differentelement_int(int array[], int min, int max)
{
	int i=min;
	int pickup[max];
	fill_int(pickup, 0, max, 0);
	int answer=0;

	rep(i, min, max)
	{
		if(detect_int(pickup, 0, answer-1, array[i])==0)
		{
			pickup[answer]=array[i];
			answer=answer+1;
		}
	}

	return answer;
}



int count_differentelement_char(char array[], int min, int max)
{
	int i=min;
	char pickup[max];
	fill_char(pickup, 0, max, '\0');
	int answer=0;

	rep(i, min, max)
	{
		if(detect_char_array(pickup, 0, answer-1, array, i, i)==0)
		{
			pickup[answer]=array[i];
			answer=answer+1;
		}
	}

	return answer;
}



int count_equalelement_int(int array[], int min, int max, int element)
{
	int i;
	int answer=0;

	rep(i, min, max)
	{
		if(array[i]==element)
		{
			answer=answer+1;
		}
	}

	return answer;
}



int count_equalelement_char(char array[], int min, int max, char element)
{
	int i;
	int answer=0;

	rep(i, min, max)
	{
		if(array[i]==element)
		{
			answer=answer+1;
		}
	}

	return answer;
}



int count_equalelement_char_array(int size_1, int size_2, char array[size_1][size_2], int min, int max, char element[])
{
	int i;
	int answer=0;

	rep(i, min, max)
	{
		if(strcmp(array[i], element)==0)
		{
			answer=answer+1;
		}
	}
	return answer;
}



void scanf_int_array(int array[], int min, int max)
{
	int i;
	rep(i, min, max)
	{
		scanf("%d", &array[i]);
	}
}



void scanf_int_array_2(int array1[], int array2[], int min, int max)
{
	int i;
	rep(i, min, max)
	{
		scanf("%d %d", &array1[i], &array2[i]);
	}
}



void scanf_int_array_3(int array1[], int array2[], int array3[], int min, int max)
{
	int i;
	rep(i, min, max)
	{
		scanf("%d %d %d", &array1[i], &array2[i], &array3[i]);
	}
}



void scanf_char(char array[], int num)
{
	scanf("%s", array);
	shift_char(array, 0, strlen(array)-1, num);
}



void scanf_char_array(int size_1, int size_2, char array[size_1][size_2], int min, int max, int num)
{
	int i;
	rep(i, min, max)
	{
		scanf_char(array[i], num);
	}

}



void printf_int_array(int array[], int min, int max)
{
	int i;
	rep(i, min, max)
	{
		printf("%d\n", array[i]);
	}
}



void printf_char_array(char array[], int min, int max)
{
	int i;
	for(i=min; i<=max; i=i+1)
	{
		printf("%c", array[i]);
	}
}










int main()
{
	int i, j;

	int N, X;
	scanf("%d %d", &N, &X);

	int L[N+1];
	scanf_int_array(L, 1, N);

	int D[N+2];
	D[1]=0;
	rep(i, 2, N+1)
	{
		D[i]=D[i-1]+L[i-1];
	}

	int count=0;
	rep(i, 1, N+1)
	{
		if(D[i]<=X)
		{
			count=count+1;
		}
	}
	printf("%d\n", count);
	return 0;
}