peterverebics/CodeNet_Python_118 huggingface dataset:
import math
a,b,c,d=map(int,input().split())
count=b-a+1
acou=((a-1)//c)+((a-1)//d)-int(((a-1)//(c*d/math.gcd(c,d))))
bcou=(b//c)+(b//d)-int((b//(c*d/math.gcd(c,d))))
print(count-(bcou-acou))
import itertools as it
import collections as col
import fractions
from functools import reduce

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

a,b,c,d=map(int,input().split())
n=b-a
print(n - ((n//c) + (n//d)) + (n//(lcm(c,d))))
import math

a,b,c,d = map(int, input().split())

C, D = c, d
if C < D:
  C, D = D, C
r = C % D
while r > 0:
  C = D
  D = r
  r = C % D
lcm = c * d // D

cPower = b//c - math.ceil(a/c) + 1
dPower = b//d - math.ceil(a/d) + 1
cdPower = b//lcm - a//lcm

print((b-a+1) - cPower - dPower + cdPower)
from fractions import gcd


def lcm(x, y):
    return (x * y) // gcd(x, y)


A, B, C, D = map(int, input().split())
print(B - A + 1 - (B // C - (A - 1) // C + B // D - (A - 1) // D - (B // (lcm(C, D) - (A - 1) // lcm(C, D)))))
import sys
sys.setrecursionlimit(10 ** 9)

def gcd(a, b):
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    else:
        return gcd(b, a // b)
    

a, b, c, d = map(int, input().split())
divc = b // c - a // c
if a % c == 0:
    divc += 1
divd = b // d - a // d
if a % d == 0:
    divd += 1
    
lcm = c * d / gcd(c, d)
divlcm = b // lcm - a // lcm
if a % lcm == 0:
    divlcm += 1


div_or = divc + divd - divlcm
print(int(b - a + 1 - div_or))
a,b,c,d=map(int,input().split())

cnt_a=a-a//c-a//d+a//(c*d)
cnt_b=b-b//c-b//d+b//(c*d)

if a%c==0 or a%d==0:
  print(cnt_b-cnt_a)
else:
  print(cnt_b-cnt_a+1)
def gcd(c, d):
  if c <= d:
    c, d = d, c
  while c % d:
    c, d = d, c % d
  return d
def lcm(c, d):
  return (c * d) // gcd(c, d)

A, B, C, D = map(int, input().split())
c_or_d = (B // C - A // C) + (B // D - A // D) -(B // lcm(C, D) - A // lcm(C, D))
print(B - A + 1 - c_or_d)
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
a,b,c,d=input2()
c_len=b//c #b以下のcの倍数の個数
d_len=b//d #b以下のdの倍数の個数
all_len=b//(c*d) #重複

ans=b-(c_len+d_len)+all_len

a-=1
ans= ans- (a-(a//c+a//d)+a//(c*d))

print(ans)
import fractions

def lcm(a, b):
    return (a * b) // fractions.gcd(a, b) 


A, B, C, D = map(int, input().split())

#間の数の個数
num = B - A + 1

CD = lcm(C, D)

c = int(num/C)
if num%C != 0 and (num%C > A%C or num%C > (C-A%C)):
    c += 1

d = int(num/D)
if num%D != 0 and (num%D > A%D or num%D > (D-A%D)):
    d += 1

cd = int(num/CD)
if num%CD != 0 and (num%CD > A%CD or num%CD > (CD-A%CD)):
    cd += 1

ans = num - (c + d - cd)
print(ans)
a,b,c,d = map(int, input().split())

c1, d1, cd1 = b // c, b // d, b // (c*d)
c2, d2, cd2 = (a-1) // c, (a-1) // d, a // (c*d)
ans = (c1+d1-cd1) - (c2+d2-cd2)
print(ans)
print((b-a+1) - ans)
A,B,C,D=map(int,input().split())

nc=int(B/C)-int((A-1)/C)
nd=int(B/D)-int((A-1)/D)
ncd=int(B/(C*D))-int((A-1)/(C*D))

print(B-A+1-nc-nd+ncd)
A,B,C,D=map(int,input().split())
Cnum=B//C-(A-1)//C
Dnum=B//D-(A-1)//D
CDnum=B//(C*D)-(A-1)//(C*D)
print(B-A+1-Cnum-Dnum+CDnum)
import math
A,B,C,D=map(int,input().split())

c=(int((B-B%C)-(A-1+C-(A-1)%C))/C)+1
d=(int((B-B%D)-(A-1+D-(A-1)%D))/D)+1
lcm=C*D/math.gcd(C,D)
candd=((B-B%lcm)-(A-1+lcm-(A-1)%lcm))/lcm+1
print(int(B-A+1-c-d+candd))
import math

def gcd(a,b):
  if b == 0:
    return a
  else:
    return gcd(b, a%b)

A, B, C, D = map(int, input().split())
count = 0
BCcount = math.floor(B / C)
BDcount = math.floor(B / D)
ACcount = math.floor((A - 1) / C)
ADcount = math.floor((A - 1) / D)
l = C * D / gcd(C, D)
BCDcount = math.floor(B / l)
ACDcount = math.floor((A - 1) / l)
Bcount = B - (BCcount + BDcount - BCDcount) 
Acount = (A - 1) - (ACcount + ADcount - ACDcount)
print(Bcount - Acount)
def abc131c_anti_division():
    import math
    cnt = 0
    a, b, c, d = map(int, input().split())
    cnt = b//c - math.ceil(a/c) + 1
    cnt += b//d - math.ceil(a/d) + 1
    e = (c*d)//math.gcd(c, d)
    cnt -= (b // e - math.ceil(a / e) + 1)
    print(int(b-a+1-cnt))
abc131c_anti_division()
import math
k = input().split()
a = int(k[0])
b = int(k[1])
c = int(k[2])
d = int(k[3])

CUpLimited = a/c
CDownLimited = b/c

DUpLimited = a/d
DDownLimited = b/d
# print((CDownLimited-CUpLimited))
# print((DDownLimited-DUpLimited))
Counter = b - a - int(CDownLimited-CUpLimited) - int(DDownLimited-DUpLimited)

print(math.floor(Counter))
a,b,c,d = map(int, input().split())

import fractions
lcmcd = a * b // fractions.gcd(c,d)
bc = b // c
ac = a // c
bd = b // d
ad = a // d
blcmcd = b // lcmcd
alcmcd = a // lcmcd

if a % c != 0:
    ac += 1
if a % d != 0:
    ad += 1
if a % lcmcd != 0:
    alcmcd += 1

print((b - a + 1) + 1 - ((bc - ac + 1) + (bd - ad + 1) - (blcmcd -alcmcd + 1)))
import numpy as np
import fractions

gcd = fractions.gcd

def main():
    #n = int(input())
    a,b,c,d = map( int, input().split())

    c_baisuu = int(b/c)-int((a-1)/c)
    d_baisuu = int(b/d)-int((a-1)/d)
    cd = int(c * d / gcd(c, d))
    cd_baisuu = int(b/(cd))-int((a-1)/(cd))
    zenbu = b-a+1
    print(zenbu-(c_baisuu+d_baisuu-cd_baisuu))
    
if __name__ == '__main__':
    main()
a,b,c,d = map(int,input().split())
count = (b-(b//c+b//d-b//(c*d))) - ((a-1)-((a-1)//c+(a-1)//d-(a-1)//(c*d)))
print(count)
a,b,c,d=map(int, input().split())
a-=1
tc = b//c-a//c
td = b//d-a//d
tcd = b//(c*d)-a//(c*d)
print(b-a-tc-td+tcd)
def main():
    def gcd(a,b):
        while b!=0:
            a,b=b,a%b
        return a
    def lcm(a, b):
        return (a * b)//gcd(a,b)

    A,B,C,D = map(int,input().split())
    minus = B-A
    print(minus-(minus//C+minus//D-(minus//(lcm(C,D)))))
 
if __name__=="__main__":
    main()
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B,C,D = list(map(int,input().split()))
num_C_bai = ((B-(B%C) - (A-(A%C)+C)))//C + 1
num_D_bai = ((B-(B%D) - (A-(A%D)+D)))//D + 1
E = lcm(C,D)
num_E_bai = ((B-(B%E) - (A-(A%E)+E)))//E + 1
print(B + 1 - A - num_C_bai - num_D_bai + num_E_bai)
import math
a,b,c,d = map(int,input().split())
e = c*d//math.gcd(c,d)
print(b-a+1 + (math.floor(b/e)-(math.ceil(a/e))+1)-(math.floor(b/c)-(math.ceil(a/c))+1)-(math.floor(b/d)-(math.ceil(a/d))+1))
A,B,C,D = map(int,input().split())
S = B-A+1
C_count = S//C
D_count = S//D
both_count = S//(C*D)
hani = C_count + D_count - both_count
print(S-hani)
import math

a,b,c,d = map(int, input().split())

lcm = int(c*d / math.gcd(c,d))

def num(i):
  ans = int(b/i) - int(a/i)
  if a % i == 0:
    ans +=1
  return ans

lcm_num = num(lcm)

cd_num  = num(c) + num(d)

num = cd_num - lcm_num

print(b-a+1-num)
import math

a, b, c, d = map(int, input().split())

lcm = c*d / math.gcd(c, d)

num = b-a
c_1 = (b-a)//c
d_1 = (b-a)//d
cd_1 = (b-a)//(lcm)

ans = num - (c_1 + d_1) + cd_1
print(int(ans))
from fractions import gcd
a,b,c,d=map(int,input().split())

def lcm(a, b):
    return a * b // gcd (a, b)

i_max=b//c
j_max=b//d
k_max=b//lcm(c,d)

i_min=a//c
j_min=a//d
k_min=a//lcm(c,d)

i=i_max-i_min
j=j_max-j_min
k=k_max-k_min

print(b-a+1-(i+j-k))
def main():
    def gcd(a,b):
        while b!=0:
            a,b=b,a%b
        return a
    def lcm(a, b):
        return (a * b)//gcd(a,b)

    A,B,C,D = map(int,input().split())
    minus = B-A+1
    print(minus-(minus//C+minus//D-(minus//(lcm(C,D)))))
 
if __name__=="__main__":
    main()
#数I
A,B,C,D = map(int,input().split())
S = B-A+1
print(S-(S//C + S//D - S//(C*D)))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B, C, D = map(int, input().split())

    all = B - A + 1
    c = -(-(B - A) // C)
    d = -(-(B - A) // D)
    cd = -(-(B - A) // (C * D))

    print(all - c - d + cd)


if __name__ == "__main__":
    main()
A, B , C , D = map(int, input().split())
count= 0
bc = B // C 
bd = B // D
bcd = B //(C*D)
can = bc + bd - bcd
ans = B - can
ac = (A-1) // C
ad = (A-1) // D
acd = (A-1) //(C*D)
can2=  ac + ad - acd
ans = ans - ((A-1) - can2)
print(ans)
from math import ceil, floor
from fractions import gcd

A, B, C, D = map(int, input().split())

def div_count(div):
  #return floor(B/div) - ceil(A/div) + 1
  return B//div - A//div + 1

div_c = div_count(C)
div_d = div_count(D)
lcm = C * D // gcd(C, D)
div_cd = div_count(lcm)

print((B - A + 1) - (div_c + div_d - div_cd))
import fractions
A,B,C,D = map(int,input().split())
g = C * D // fractions.gcd(C,D)
# A以下
cntA = 0
cntA += A // C
cntA += A // D
cntA -= A // g

# B未満
cntB = 0
cntB += (B-1) // C
cntB += (B-1) // D
cntB -= (B-1) // g

cnt = cntA - cntB
cnt = (A - B + 1) - cnt

print(cnt)
import math

a,b,c,d = map(int,input().split())

s1=b//c - a//c
s2=b//d - a//d
s12=int( b//(c*d/math.gcd(c,d)) - a//(c*d/math.gcd(c,d)) )

print(b-a+1-(s1+s2-s12))
import sys
input = sys.stdin.readline
import fractions

def main():
    A, B, C, D = list(map(int, input().split()))
    Aone = A - 1
    lcm = int(C / fractions.gcd(C, D) * D)

    Bc = int(B / C)
    Bd = int(B / D)
    Blcm = int(B / lcm)
    Bdec = B - Bc - Bd + Blcm

#    print(Bc,Bd,Blcm)

    Ac = int(Aone / C)
    Ad = int(Aone / D)
    Alcm = int(Aone / lcm)
    Adec = Aone - Ac - Ad + Alcm

#    print(Ac,Ad,Alcm)

    print(Bdec - Adec)


main()
a,b,c,d = map(int,input().split())
ans = 0
for i in range(a,b+1):
  if(i%c!=0)and(i%d!=0):
    ans += 1
a,b,c,d = map(int,input().split())

n = b-a-1
n_c = n//c
n_d = n//d
n_gap = n//(c*d)

print(n-n_c-n_d+n_gap+1)
import fractions
a,b,c,d=map(int,input().split())
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
ans=b//d + b//c - (a-1)//c - (a-1)//d - b//lcm(c,d) - (a-1)//lcm(c,d)
ans=b-a+1-ans
print(ans)
import math

a, b, c, d = map(int, input().split())
lcm_cd = c * d // math.gcd(c, d)

ans_lt_b = b - (b // c + b // d - b // lcm_cd)
ans_lt_a = (a - 1) - (((a - 1) // c) + ((a - 1) // d) + ((a - 1) // lcm_cd))
print(ans_lt_b - ans_lt_a)
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a,b,c,d=map(int,input().split())
c_div=math.floor(b/c)-math.ceil(a/c)+1
d_div=math.floor(b/d)-math.ceil(a/d)+1
cd_div=math.floor(b/lcm(c,d))-math.ceil(a/lcm(c,d))+1

ans=(b-a+1)-((c_div)+(d_div)-(cd_div))
print(ans)
a,b,c,d = map(int,input().split())
e = c*d
h = b-a+1
print(h//c+h//d+h//e)
a,b,c,d=map(int,input().split())

def div(x,y):
  return y//x

def div2(x):
  return div(x,b)-div(x,a)
  
print(b-a+1-div2(c)-div2(d)+div2(c*d))
A,B,C,D = map(int,input().split())
count = 0
for i in range(A,B+1):
  if i%C != 0 and i%D != 0:
    count += 1
    i += 1
  else:
    i += 1
    break
print(count)
import math

a,b,c,d = map(int,input().split())

s1=b//c - (a-1)//c
s2=b//d - (a-1)//d
s12=int( b//(c*d/math.gcd(c,d)) - (a-1)//(c*d/math.gcd(c,d)) )
print(b-a+1-(s1+s2-s12))
import fractions
a,b,c,d=map(int, input().split())
cdlcm= a*b//fractions.gcd(a,b)
a-=1
tc = b//c-a//c
td = b//d-a//d
tlcm = b//cdlcm-a//cdlcm
print(b-a-tc-td+tlcm)
a,b,c,d = map(int, input().split())
count = 0

#最大公約数
def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a
 #最小公倍数
def lcm(a,b):
    return a*b // gcd(a,b)

gcd_num = lcm(c,d)

#a
a_count = a // c
a_count = a_count + (a//d)
a_count = a_count - (a//gcd_num)
a_count = a-a_count

#b
b_count = b // c
b_count = b_count + (b//d)
b_count = b_count - (b//gcd_num)
b_count = b-b_count

div = b-count-a_count
print(div)
from fractions import gcd

a, b, c, d = map(int,input().split())

if a%c == 0:
    c_number = b // c - a // c + 1
else:
    c_number = b // c - a // c
if a%d == 0:
    d_number = b // d - a // d + 1
else:
    d_number = b // d - a // d
if a%(c*d) == 0:
    cd_number = b // (c*d / gcd(c,d)) - a // (c*d / gcd(c,d)) + 1
else:
    cd_number = b // (c*d / gcd(c,d)) - a // (c*d / gcd(c,d))
print(int((b-a+1) - (c_number + d_number - cd_number)))
from fractions import gcd

A, B, C, D = map(int, input().split())

c_div = B//C - (A-1)//C
d_div = B//D - (A-1)//D
g = C*D // gcd(C, D)
cd_div = B//g - (A-1)//g
tot = B - A + 1
print(tot - c_div - d_div + cd_div)

print(tot, c_div, d_div, cd_div)
a,b,c,d=map(int,input().split())
base=b-a+1
n_c=b//c-(a+c-1)//c+1
n_d=b//d-(a+d-1)//d+1
cd=c*d
n_cd=b//cd-(a+cd-1)//cd+1
print(base-n_c-n_d+n_cd)
a,b,c,d=map(int,input().split())
print(b-a+1-(b//c+b//d-b//(c*d)+a//c+a//d-a//(c*d)))
import fractions
from functools import reduce


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


A, B, C, D = map(int, input().split())
ans_b = B - int(B / C) - int(B / D) + int(B / lcm_base(C, D))
B = A - 1
ans_a = B - int(B / C) - int(B / D) + int(B / lcm_base(C, D))
print(ans_b - ans_a)
import fractions

A, B, C, D = map(int, input().split())


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


LCM_CD = lcm(C, D)
C_Count = B // C - A // C
D_Count = B // D - A // D
CD_Count = B // (LCM_CD) - A // (LCM_CD)

print(B - A + 1 - C_Count - D_Count + CD_Count)
import math

a,b,c,d = map(int, input().split())

lcm = c*d / math.gcd(c,d)

def num(i):
  ans = b//i - a//i
  if a % i == 0:
    ans +=1
  return ans

lcm_num = num(lcm)

cd_num  = num(c) + num(d)

num = cd_num - lcm_num

print(b-a+1-num)
import math
a,b,c,d=map(int,input().split())
print(a)
from math import gcd, ceil
a, b, c, d = map(int, input().split())
lcm = c * d // gcd(c, d)
ans = (b-a+1 - ceil((b-a+1)/c) - ceil((b-a+1)/d) + ceil((b-a+1)/lcm))
print(ans)
# AtCoder Beginner Contest 131
# C - Anti-Division
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B,C,D=map(int,input().split())
bc=B//C
ac=A//C
cnum=bc-ac

bd=B//D
ad=A//D
dnum=bd-ad


lcmcd=lcm(C,D)
blcmcd=B//lcmcd
alcmcd=A//lcmcd
lcmcdnum=blcmcd-alcmcd

print(B-A-cnum-dnum+lcmcdnum)
#abc133 c
from fractions import gcd
a,b,c,d=map(int,input().split())
"""
def gcd(x,y):
    if y==1:
        return x
    return gcd(y,x%y)
"""

def lcm(x,y):
    return (x*y)//gcd(x,y)

e=lcm(c,d) #c,dの最小公倍数

def kosu(num):
    z=num
    nc=int(num/c)
    nd=int(num/d)
    ne=int(num/e)
    return z-nc-nd+ne

ans=kosu(b)-kosu(a-1)

print(ans)
a, b, c, d = map(int, input().split())
print(a,b,c,d)

from fractions import gcd
lcm = c * d / gcd(c, d)
print(lcm)

num = 0
for i in range(a, b+1):
    if i % c == 0:
        num += 1
    if i % d == 0:
        num += 1
    if i % lcm == 0:
        num -= 1

print(b - a + 1 - num)
import math
def gcd(a,b):
	if a==0:
		return b
	else:
		return gcd(b%a,a)
def lcm(a,b):
	return (a*b)/gcd(a,b)

def main():
	a ,b,c,d = map(int,input().split())
	lc = lcm(c,d)
	cnt = (math.floor((b)/c)-math.floor((a)/c))+(math.floor((b)/d)-math.floor((a)/d))- (math.floor((b)/(lc))-math.floor((a)/(lc)))
	print((b-(a-1))-cnt)
	

main()
from math import gcd
A, B, C, D = map(int, input().split())
E = C*D//gcd(C, D)
ans = B-A+1 - (B//C-(A-1)//C + B//D-(A-1)//D - B//E-(A-1)//E)
print(ans)
def resolve():
    from fractions import gcd
    a, b, c, d = map(int, input().split())
    e = int(c*d/gcd(c,d))
    db = int(b - (int(b/c) + int(b/d) - int(b/e)))
    da = int((a-1) - (int((a-1)/c) + int((a-1)/d) - int((a-1)/e)))
    print(int(db-da))
from math import gcd
a, b, c, d = map(int,input().split())
if a % c ==0:
    c_explicit = b // c - a // c + 1
else:
    c_explicit = b // c - a // c 
if a % d ==0:
    d_explicit = b // d - a // d + 1
else:
    d_explicit = b // d - a // d 
e = gcd(c, d)
gcl = (c / e) * (d / e) * e
if a % gcl ==0:
    e_explicit = b // gcl - a // gcl + 1
else:
    e_explicit = b // gcl - a // gcl 
print(c_explicit, d_explicit, e_explicit, gcl)
g = b - a + 1 - c_explicit - d_explicit + e_explicit
print(int(g))
A,B,C,D=map(int,input().split())
a=(B//C)-(A//C)
b=(B//D)-(A//D)
c=(B//(C+D))-(A//(C+D))
print(B-A-a-b+c)
from math import gcd

a, b, c, d = map(int, input().split())
x = (b // c) - ((a-1) // c)
y = (b // d) - ((a-1) // d)
z = (b // gcd(c, d)) - ((a-1) // gcd(c, d))
print(b-a+1-(x+y-z))
# B
n,x = map(int, input().split())
d = 0
count = 1
l = list(map(int, input().split()))
for i in range(n):
    d += l[i]
    if d <= x:
        count+=1
print(count)
n, x = map(int, input().split())
L = list(map(int, input().split()))

ans = 1
d = 0
for l in L:
    d = d + l
    if d <= x:
        ans += 1
    else:
        break
        
print(ans)
n,x = map(int,input().split(" "))
l = list(map(int,input().split(" ")))
y = 0
for i in l:
    y += i
if y <= x:
    print(n+1)
else:
    count = 1
    d = 0
    j = 0
    while d < x:
        d += l[j]
        j += 1
        if d <= x:
            count += 1
    print(count)
icase=0
if icase==0:
    n,x=map(int,input().split())
    l=list(map(int,input().split()))
    d=0
    for i in range(n):
        d=d+l[i]
        if d>x:
            print(i+1)
            break
    if d<=x:
        print(n+1)
n,x=map(int,input().split())
*l,=map(int,input().split())
t=[0]
for i in range(n):
    d=l[i]+t[-1]
    t.append(d)
ans=[j for j in t if j <= x]
print(len(ans))
N,X=map(int,input().split())
L=list(map(int,input().split()))

count=0
dist=0
L.append(0)

i=0
while dist<=X and count<=N:
    dist+=L[count]
    count+=1
    #print(dist)

print(count)
from itertools import accumulate
n,x = map(int,input().split())
lst_l = [0] + list(map(int,input().split()))
lst_wa = list(accumulate(lst_l))
cnt = 0
for i in lst_wa:
    if i <= x:
        cnt += 1
print(cnt)
n, x = map(int, input().split())
(*l,) = map(int, input().split())
a = [0]
for i in l:
    if a[-1] + i > x:
        break
    a.append(a[-1] + i)
print(len(a))
import sys
N,X = map(int,input().split())
array = list(map(int,input().split()))

count = 1
point = 0
for I in range(len(array)):
    point += array[I]
    if point <= X:
        count += 1
    else:
        break
print(count)
n,x = list(map(int,input().split()))
l = list(map(int,input().split()))
l.insert(0,0)
r = 0
n_l = []
for i in l:
    r += i
    n_l.append(r)

ans = 0
for i in n_l:
    if i <= x:
        ans += 1

print(ans)
N,L=map(int,input().split())
A=list(map(int,input().split()))
hane=1
count=0
for i in range(N):
    count+=A[i]
    hane+=1
    if count==L:
        break
    elif count>L:
        hane-=1
        break

print(hane)
N,X=map(int,input().split())
L=list(map(int,input().split()))
mem=0; ans=1
for i in L:
    mem+=i
    if mem<=X: ans+=1
print(ans)
a,b=map(int,input().split())
list=list(map(int,input().split()))
 
count=0
count2=1
for i in range(a):
  count+=list[i]
  if count<=b:
    count2+=1
    
print(count2)
def resolve():
    n,x=map(int, input().split())
    l=list(map(int, input().split()))
    num=1
    zahyou=0
    for i in range(n):
        zahyou+=l[i]
        if zahyou<=x:
            num+=1
    print(num)
resolve()
N,X = map(int,input().split())
L = list(map(int,input().split()))

tmp = 0
cnt = 1

for i in range(N):
    tmp += L[i]

    if(tmp <= X):
        cnt += 1
print(cnt)
#!/usr/bin/env python3
import numpy as np


def main():
    N, X = map(int, input().split())
    L_list = list(map(int, input().split()))
    L_sum = np.cumsum(L_list)
    print(np.where(L_sum <= X)[0][-1] + 2)


if __name__ == '__main__':
    main()
def main():
  n, x, *ls = map(int, open(0).read().split())
  d=0
  cou=1
  for l in ls:
    d += l
    if d <= x:
      cou+=1
    else:
      return(cou)
  return n+1
if __name__ == '__main__':
  print(main())
n,x = map(int, raw_input().split(' '))
ais = map(int, raw_input().split(' '))
count,cur,i = 1,0, 0
res = []
while(i < len(ais)):
	cur += ais[i]
	if cur <= x:
		count+=1
	else:
		break

	i +=1
print count
#print len([e for e in res if e <= x])
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n,x=MI()
ls=LI()
dp=[0 for i in range(n+1)]
for i in range(n):
    dp[i+1]=dp[i]+ls[i]
#print(dp)
count=0
for d in dp:
    if d<=x:
        count+=1
print(count)
N, X = map(int, input().split())
L = list(map(int, input().split()))

ans = 1
d = 0
for l in L:
  if d + l <= X:
    d += l
    ans += 1
  else:
    break

print(ans)
n,x=map(int,input().split())
L=list(map(int,input().split()))
cnt=0
ans=1
for l in L:
    cnt+=l
    if cnt>x:
        break
    ans+=1
print(ans)
N, X = map(int, input().split(' '))
L_ls = map(int, input().split(' '))
D, cnt = 0, 1
for L in L_ls:
    D += L
    if D > X:
        break
    cnt += 1
print(cnt)
N, X = map(int,input().split())
lst = list(map(int,input().split()))

cnt = 1
now = 0
for i in range(N):
    l = now + lst[i]
    if l > X:
        break
    else:
        cnt += 1
        now = l
    

print(cnt)
n, x = map(int, input().split())
l = list(map(int, input().split()))

d = 0
cnt = 0
for i in range(n):
    if d <= x:
        cnt += 1
    d += l[i]
if d <= x:
    cnt += 1
print(cnt)
n,k=map(int, input().split(' '))
a=list(map(int, input().split(' ')))
ans,s=0,0
for i in a:
  if s<=k: ans+=1
  else: break
  s+=i

if s<=k: ans+=1
print(ans)
n, x = map(int, input().split())
l = list(map(int, input().split()))
ans = 1
d = 0
for i in l:
    d = d + i
    if d <= x: ans += 1
print(ans)
import bisect
import sys
input = sys.stdin.readline

N,X = list(map(int,input().split()))
L = list(map(int,input().split()))
bn = [0]
for i in range(N):
    bn.append(bn[-1]+L[i])
print(bisect.bisect_right(bn,X))
n,x=map(int,input().split())
li=list(map(int,input().split()))
ans=1
l=0
for i in li:
  l+=i
  if l>x:
    break
  ans+=1
print(ans)
import sys
sys.setrecursionlimit(10**6)

#a = int(input())
#b = list(map(int, input().split()))
n, x = map(int, input().split())
#s = input()
#s,t = input().split()
#
readline = sys.stdin.readline
l = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

ans = 1
height = 0
for i in range(n):
    height += l[i]
    if height <= x:
        ans += 1
    else:
        break
print(ans)
# B - Bounding

N, X = map(int, input().split())
L = [int(l) for l in input().split()]
D = 0
cnt = 1
for i in range(N):
    D = D + L[i]
    if D <= X:
        cnt += 1

print(cnt)
N,X = list(map(int,input().split()))
L_list = list(map(int,input().split()))

ans = 1
current = 0

for i in range(N):
  current += L_list[i]
  if current <= X:
    ans += 1
    
print(ans)
from itertools import accumulate
from bisect import *
N, X = map(int, input().split())
L = list(map(int, input().split()))
S = list(accumulate([0]+L))
print(bisect_right(S,X))
from collections import defaultdict


def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n, x = Input()
    l = Input()
    d = defaultdict(int)
    d[0] = 0
    ans = 0

    for i in range(1, n+1):
        d[i] = d[i-1] + l[i-1]

    for i in d.values():
        if i <= x: ans += 1

    print(ans)

main()
n, x = map(int, input().split())
l = list(map(int, input().split()))

d = 0
count = 1
for v in l:
    dv = d + v
    # print(dv)
    
    if dv > x:
        break
    
    count += 1
    d += v

print(count)
N,X = map(int,input().split())
L = list(map(int,input().split()))
count = 1
posi = 0
for i in L:
    posi +=i
    if(posi<=X):
        count+=1
    else:
        break
print(count)
N, X = map(int, input().split())
Ls = list(map(int, input().split()))

ans = 1
D = 0
for L in Ls:
    D += L
    ans += D <= X

print(ans)
N,X = map(int,input().split())
list = list(map(int, input().split()))

cnt = 1
sum = 0

for i in list:
    sum += i
    if sum <= X:
        cnt += 1

print(cnt)
n,x=map(int,input().split())
l=[int(x) for x in input().rstrip().split()]
now=0
cnt=1
for i in range(n):
  now+=l[i]
  if x<now:
    break
  cnt+=1
print(cnt)
n, x = map(int, input().split())
Ls = list(map(int, input().split()))
ans = 1
temp = 0
for l in Ls:
  temp += l
  if temp <= x:
    ans += 1
print(ans)
n,x=map(int,input().split())
l=list(int(i) for i in input().split())
s=[]
for i in range(len(l)+1):
  t=sum(l[:i])
  if t <= x:
    s.append(t)
print(len(s))
n,x= input().split()
b_list= list(map(int, input().split()))
temp = 0
counter = 1
for i in range(int(n)):
    temp += b_list[i]
    if (temp<=int(x)):
        counter +=1
    else:
        break

print(counter)
n,x=map(int,input().split())

l=list(map(int,input().split()))

ans=1

cursum=0

for i in range(n):
  cursum+=l[i]
  if cursum <= x:
    ans+=1
    
print(ans)
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=[0]
for i in range(n):
  d.append(d[i]+l[i])
  if d[i+1]>x:
    print(i+1)
    break
else:
  print(n+1)
n, x = map(int, input().split())
l = [int(i) for i in input().split()]
b = 0
c = 1
for i in range(n):
    if b + l[i] <= x:
        b += l[i]
        c += 1
    else:
        break
print(c)