If
A={{a1},{a1,a2}} & B={{b1},{b1,b2}} then
a1∈/A & b1∈/B.
But
{a1}∈A & {a1,a2}∈A so if we know that
A=B.
Then it must be true that
{a1}∈B & {a1,a2}∈B. Do you follow that?
Knowing that
B={{b1},{b1,b2}} that means
{a1}={b1} or {a1}={b1,b2}
Using both of those can you show that
a1=b1 & a2=b2 ?
Whoever wrote this problem is getting you ready for the definition of
ordered-pairs.