var n,m,i,x:longint; a:array[1..110] of longint; function minID:longint; var i,min:longint; begin min:=a[1]; minID:=1; for i:=2 to m do if a[i]<min then begin min:=a[i]; minID:=i; end; end; function maxID:longint; var i,max:longint; begin max:=a[1]; maxID:=1; for i:=2 to m do if a[i]>max then begin max:=a[i]; maxID:=i; end; end; begin assign(input,'waterj.in'); reset(input); assign(output,'waterj.out'); rewrite(output); readln(n,m); for i:=1 to m do read(a[i]); for i:=m+1 to n do begin read(x); inc(a[minID],x); end; writeln(a[maxID]); close(input); close(output); end.