# -*- coding: utf-8 -*-
def seach (place, ary, dist, top, last)
  half1 = (last+top)/2
  half2 = half1++1
  if place < ary[half1]
    seach(place, ary, dist, top, half1-1)
  
  elsif ary[half2] < place
    seach(place, ary, dist, half2+1, last)
  else 
    if place - ary[half1] < ary[half2] - place
      return place - ary[half1]
    else
      return ary[half2] - place
    end
  end
end

d = gets.chomp.to_i #??¨???
while d != 0  
  n = gets.chomp.to_i #????????°
  m = gets.chomp.to_i #??¨?????°

  dAry = [] #????????????
  dAry[0] = 0
  for i in 1..n-1
    dAry[i] = gets.chomp.to_i
  end
  dAry[dAry.length] = d
  dAry = dAry.sort

  sum = 0
  kAry = [] #?????????
  for i in 0..m-1
    sum += seach(i, dAry, d, 0, dAry.length-1)
    kAry[i] = gets.chomp.to_i
  end
  
  puts sum

  d = gets.chomp.to_i #??¨???
end