Calculate minimum difference
for c in range ( 0 , n + 1 , 1 ) : NEW_LINE INDENT suml = sum ( b1 [ : c + 1 ] ) NEW_LINE sumr = sum ( b2 ) NEW_LINE if suml >= sumr : NEW_LINE INDENT rem = suml - sumr NEW_LINE if rem < mini : NEW_LINE INDENT mini = rem NEW_LINE index = c NEW_LINE DEDENT DEDENT DEDENT return index , mini NEW_LINE