N,k = map(int,input().split()) arr = list(map(int,input().split())) sum = 0 length = 0 tmp_dict = {0:-1} for i in range(len(arr)): sum += arr[i] if sum not in tmp_dict: tmp_dict[sum] = i if sum - k in tmp_dict: length = max(length,i-tmp_dict[sum - k]) print(length)