recursion – TOP p most informative elements in a mutually recursive multisets?

Let say we have two groups of multi-sets /repeatable elements are allowed/ i.e.

A = [ A1,A2,A3, ... , An ] <= a list/group of multi-sets
B = [ B1,B2,B3, ... , Bm ]

where :

Ai = { b1,b12,b7,b12 ...}
Bi = { a4,a57,a16, ...}

or if we count the elements :

Ai = { b1:1,b12:5,b7:3 ...}
Bi = { a4:11,a57:3,a16:1, ...}

lowercase is ID identifing a set f.e. b7 refer to the B7 set..

I.e. those are mutually recursive multi-sets A and B.

The question is given a set Ai how can I find the ‘p’ most important/informative elements of the set, so i can keep them and remove the rest.

Is there a mathematical or algorithmic way to figure that out ?