def g;$z=gets.split.map &:to_i;end
def f x,y
a=g<<1;b,c,d=y<2?[a.map{1}]*3:f(x,y-1)
[a,(0..x-1).map{|i|a[i]>1?d[i]:a[i]>0?0:c[i]+(b[i-1]<1?c[i-1]:0)+(b[i+1]<1?c[i+1]:0)}<<0,c]end
p f(*$z)[1].inject(:+)while g[0]>0