INF=10**18; def op(a,b): c=[[-INF]*len(b[0])for i in range(len(a))] for i in range(len(a)): for j in range(len(b[0])): c[i][j]=max([min(a[i][k],b[k][j])for k in range(len(b))]) return c def e(K): a=[[-INF]*K for i in range(K)] for i in range(K): a[i][i]=INF; return a def my_pow(a,b): if b==0: return e(len(a)) if b%2==1: return op(my_pow(a,b-1),a) c=my_pow(a,b//2); return op(c,c) K,N=map(int,input().split()) assert 1<=K<=100 assert 0<=N<=INF A=list(map(int,input().split())) B=list(map(int,input().split())) for i in A: assert -INF<=i<=INF for i in B: assert -INF<=i<=INF a=[[-INF]for i in range(K)] b=[[-INF]*K for i in range(K)] for i in range(K): a[i][0]=A[i] for i in range(K): b[K-1][i]=B[i] for i in range(K-1): b[i][i+1]=INF print(op(my_pow(b,N),a)[0][0])