Modeling a restriction in a composition relationship


I have an object of class A, wich has 0 or many objects of class B.

Object B has an attribute called x, wich is an enum.

An object A can have many objects of class B, but each object B inside A must have a differente value for its attribute x.

I know how to model that an object of class A has 0 or many objects of type B, using composition inside a class diagram, but how do i model the above restriction?