while 1
    n, m = gets.split.map(&:to_i)
    break if n == 0
    hash = { 0 => 0 }
    n.times do
        x = gets.to_i(2)
        new_hash = Hash.new(0)
        hash.each do |y, k|
            new_hash[y] = k if k >= new_hash[y]
            z = y ^ x
            new_hash[z] = k + 1 if k + 1 >= new_hash[z]
        end
        hash = new_hash
    end
    p hash[0]
end
