{-# LANGUAGE BangPatterns #-} import Control.Monad import qualified Data.ByteString.Char8 as BS import Data.Char import Data.List import Data.Maybe readInt = fst . fromJust . BS.readInteger readIntList = map readInt . BS.words getInt = readInt <$> BS.getLine getIntList = readIntList <$> BS.getLine solve :: [Integer] -> Int -> Integer solve !s !n = uncurry max $ foldl' (\(!a, !b) !c -> (max (b - c) a, max (a + c) b)) (0, 0) s main = do [n, m] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine a <- replicateM n $ sum <$> getIntList print $ solve a n