Suppose that I have a line in an $n$-dimensional space described by $$ X=A+Bk, \quad \quad X,A,B \in \mathbb{R}^n, k \in \mathbb{R} $$ here $A$ is known and I want to find all the possible vectors $B$ such that this line has one and only one intersection with the set $S$ described by: $$S=\{ X \in \mathbb{R}^n \: | \: 0 \le X \le W\} $$ where $W \in \mathbb{R}_+^n$ and the inequalities are to be intended component-wise.
Is there any closed-form formula for such vectors $B$?