m, f = gets.split(' ').map(&:to_i) hash = {true => "YES\n#{f - m - 1}", false => "NO\n#{m + 1 - f}"} puts hash.to_proc[f > m]