ll n,k;mint r,v[5d4];{rd(n,k);*v=1;rep(i,2,n+1){v[1..k]+=v[0..];v[-(-k..-i)]-=v[-(i-k..)];}r+=v[0..k];wt(r);}