while 1
    n, m = gets.split.map(&:to_i)
    break if n == 0
    min = {}
    max = {}
    (1..n).each {|i| min[i] = max[i] = 0}
    m.times do
        s, k, *cs = gets.split.map(&:to_i)
        min[cs[0]] += s if k == 1
        cs.each do |c|
            max[c] += s
        end
    end
    min_key, second_min_key = min.keys.sort_by {|i| min[i]}[0..1]
    second_max_key, max_key = max.keys.sort_by {|i| max[i]}[-2..-1]
    if min_key != max_key
        p max[max_key] - min[min_key] + 1
    else
        p [max[max_key] - min[second_min_key], max[second_max_key] - min[min_key]].max + 1
    end
end
