import Data.List (sortBy)
import Data.Ord (comparing)
import Data.Function (on)


sortDesc::[Int]->[Int]
sortDesc = sortBy (comparing negate)

sn::Int->Int
sn n = n * (n + 1)

div' = (/) `on` fromIntegral

main = do
  [n, k] <- map read . words <$> getLine
  pn <- map read . words <$> getLine
  let pn' = take k $ sortDesc pn
  let l = foldl1 lcm pn'
  print $ div' (sum $ map (\x -> (div l x) * (sn x)) pn') (2 * l)