import sys input = sys.stdin.readline N,K=map(int,input().split()) A=list(map(int,input().split())) C=list(map(int,input().split())) DP=[[[10**9,-1] for i in range(N)] for j in range(N)] for i in range(N): DP[i][0]=[C[i],C[i]] for j in range(1,N): for i in range(N): # DP[i][j] # [i,i+j] for k in range(j): # [i,i+k], [i+k+1,j] # DP[i][k], DP[i+k+1][j-k] a,b=DP[i][k] c,d=DP[(i+k+1)%N][j-k-1] #print(j,i,k,a,b,c,d) if a==10**9 or c==10**9: continue if (bK) or (dK): continue else: DP[i][j][0]=min(DP[i][j][0],a,c) DP[i][j][1]=max(DP[i][j][1],b,d) S=[0] for a in A+A: S.append(S[-1]+a) ANS=0 for i in range(N): for j in range(N): if DP[i][j][1]!=-1: ANS=max(ANS,S[i+j+1]-S[i]) print(ANS)