k, n = gets.split.map(&:to_i) i = gets.split.map(&:to_i).inject(k * n, &:-) puts i >= 0 ? i : -1