let A does the work in 40 mins (given)
let B does the work in x mins
amt of work done by A in 1 min 1/40
amt of work done by B in 1 min 1/x
amt of work done jointly by both A & B 1/24
which implies (1/40)+(1/x) (1/24)
on solvin the above eqn. for x we get
x 60