N, M = gets.split.map(&:to_i) X = gets.split.map.with_index { |x, i| [x.to_i, i] }.sort_by(&:first) Y = gets.split.map(&:to_i).sort ans = Array.new(N) X.each do |x, idx| while Y.size > 0 && Y[0] < x Y.shift end if Y.empty? ans[idx] = 'Infinity' else ans[idx] = Y[0] - x end end puts ans