Explanation
The Magnetic field produced at any point inside the solenoid
S1 due to the current l1 is B1=μ0N1I1l
Flux linked with each turen of S2=B1A
Total Magnetic flux with linked with solenoid having N2 turns is
ϕ2=B1AN2=(μ0N1I1l)AN2
up to
ϕ2=Ml1
M=μ0N1N2Al