import sys from heapq import heappush, heappop read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, K = map(int, readline().split()) A = [0] + list(map(int, readline().split())) B = [0] + list(map(int, readline().split())) if N == 1: print(0) exit() q = [(A[1] + B[2], 2)] done = [0] * (N + 1) done[1] = 1 ans = 0 while q: t, j = heappop(q) if done[j]: continue if j in (N - 1, N): ans = max(ans, t) done[j] = 1 # j+1 への伝搬 if j < N: t1, j1 = t + A[j] + B[j + 1], j + 1 heappush(q, (t1, j1)) # j+2 への伝搬 if j < N - 1: t1, j1 = t + A[j] + B[j + 2] + K, j + 2 heappush(q, (t1, j1)) print(ans)