def func(arr: list, k: int):
    length = len(arr)
    for i in range(1, length + 1):
        for j in range(length + 1 - i):
            if sum(arr[j:j + i]) >= k:
                return i


k = int(input())
a = input()
arr = list(map(int, a.split(',')))
print(func(arr, k))

e5df2979d8db2acf90934af66fb9f227d4655e49
<mask token>

def func(arr: list, k: int):
    length = len(arr)
    for i in range(1, length + 1):
        for j in range(length + 1 - i):
            if sum(arr[j:j + i]) >= k:
                return i


<mask token>

def func(arr: list, k: int):
    length = len(arr)
    for i in range(1, length + 1):
        for j in range(length + 1 - i):
            if sum(arr[j:j + i]) >= k:
                return i


<mask token>
print(func(arr, k))

def func(arr: list, k: int):
    length = len(arr)
    for i in range(1, length + 1):
        for j in range(length + 1 - i):
            if sum(arr[j:j + i]) >= k:
                return i


k = int(input())
a = input()
arr = list(map(int, a.split(',')))
print(func(arr, k))
