object Main extends App {
  def abs(num:Long) = {
    if (num > 0){
      num
    } else {
      -num
    }
  }
  val sc = new java.util.Scanner(System.in)
  val n,m = sc.nextInt()
  val a = Array.fill(n,3)(sc.nextLong())
  val result = a.combinations(m).map(ai=>{
    val x = abs(ai.map(_(0)).sum)
    val y = abs(ai.map(_(1)).sum)
    val z = abs(ai.map(_(2)).sum)
    x+y+z
  }).max
  println(result)
}