a,b=gets.split(' ').map{|i|i.to_i} o=u=1 a.times{ o=u t=[] b.times{ t<