### constant

PI2 = Math::PI * 2

### main

loop do
  n, m = gets.split.map(&:to_i)
  break if (n | m) == 0

  pis = []
  while pis.length < n
    pis += gets.split.map(&:to_f)
  end

  ars = n.times.map{n.times.map{nil}}
  
  for i in (0...n)
    for j in (0...n)
      ars[i][j] = 0.5 * Math.sin(PI2 * (pis[j] - pis[i]))
    end
  end
  #p ars

  trs = n.times.map{n.times.map{n.times.map{nil}}}

  for i in (0...n)
    for j in ((i + 1)...n)
      for k in ((j + 1)...n)
        trs[i][j][k] = ars[i][j] + ars[j][k] + ars[k][i]
      end
    end
  end
  #p trs

  maxars = (m + 1).times.map{n.times.map{n.times.map{0.0}}}

  for c in (3..m)
    for i in (0...n)
      for j in ((i + 1)...n)
        for k in ((j + 1)...n)
          ar = maxars[c - 1][i][j] + trs[i][j][k]
          maxars[c][i][k] = ar if maxars[c][i][k] < ar
        end
      end
    end
  end

  puts "%.6f" % maxars[m].flatten.max
end