Python3の解答がなくて涙
何度も試行錯誤してやっと通過したので忘備録で残します
N,X = map(int,input().split())
A = list(map(int,input().split()))
S = [0]
max_num = 0
max_i = 0
for i in range(0,N):
S.append(S[i] + A[i])
for i in range(0,N-X+1):
if max_num < S[X+i] - S[i]:
max_num = S[X+i] - S[i]
max_i = i
print(max_num,A[max_i])