Suppose I have a set $A=\{a_1,a_2,...,a_n\}$ and a metric $f$ on $A$. I want to extract a subset $B$ of size $k$ such that it maximizes the sum of the distances between every possible pair in B. i.e. to maximize:
$$\sum _{a_i,a_j\in B, a_i\neq a_j} f(a_i,a_j)$$
Is there any known algorithm to do this?