Since EB is parallel to CD, triangles ABE and ACD are similar. So, we can set up a proportion between correspondent sides:
[tex]AE\div AD = AB \div AC[/tex]
Substituting values, we have
[tex]16\div 40=35-x\div 35[/tex]
This implies
[tex]40(35-x)=560 \iff 1400-40x=560 \iff 40x=840 \iff x=21[/tex]