Amplitude analysis of the B+ -> D+D-K+ decay