6 students are J, E, M, L, H and P.
We have 2 conditions to consider, Firstly, if E is selected P would also be selected, but M will not be selected.
Secondly, if M is selected E would not be selected and if E is not selected certainly P would also not be selected.
Now, consider the first condition, where E is selected, so, we are left with, E, P, J, L, H.
Since, E is selected, then P must be selected, we can consider EP as one member, now, we are actually left with four member, EP as one and remaining three are J, L, H.
So, the possible arrangement would be 4C3=4 ways.
Now, consider the second condition, where M is selected, E and P will not be selected.
So, we are left with 4 members that are M,J,L,H. Posssible arrangement with these members are 4C4=1
Hence, total teams that can be formed according to given constraints, 4+1=5
Answer, B.