My title is a bit blurry, but I can't find more correct description.
I have two columns with related data. In column A I have numbers that could appear mutiple times and in column B each number has a corresponding text value. What I want to get is only unique numbers in column A and all corresponding text values from column B to appear on the same row, but in different columns, like this:

What I have:
1.jpg


What I want:
2.jpg

How could this be done with a formula?