Your function is From A to B and |A|=m and |B|=n
A to B is a Function means, Element from A should be mapped to only one element of B, it may be any element in B
A to B is a One-to-One Function means, Element from A should be mapped to only one element of B, it may be any element in B and Element from B should be mapped to only one element of A, it may be any element in A
there are m elements in A, let name them as a1,a2,a3,a4,a5,a6....am and there are n elements in B, let name them as b1,b2,b3,b4,b5,b6....bn
a1 can mapped to any element of B ====> n choices for mapping a1 ( Why n ? due to there are n elements in B)
a2 can mapped to any element of B except one element which is already mapped to a1 ===> n-1 choices for mapping a2
a3 can mapped to any element of B except two elements which is already mapped to a1 and a2 ===> n-2 choices for mapping a3
.
.
.
am can mapped to any element of B except m-1 elements of B which is already mapped to a1 and a2,...am-1 ===> n-(m-1) choices for mapping am
We have Multiply them = (n) . (n-1) . (n-2) ..... ( n- (m-1) ) = $ \frac{ (n) . (n-1) . (n-2) ..... ( n- (m-1) ) {\color{Blue} (n-m)! }}{\color{Blue} (n-m)! } $ = $ \frac{n!}{(n-m)!}$ = nPm