number_log=gets.chomp.split.map(&:to_i) log=Array.new(number_log[1]) card_count=Array.new(number_log[1]) number_log[1].times do|i| log[i]=gets.chomp card_count[i]=0 end current_id=0 counter=0.to_i squential_flow=1 draw_count=1 while counter