  A set ${\cal A} \subseteq \Set{1,...,N}$ is of type $B_2$ if all sums $a+b$,
with $a\ge b$, $a,b\in {\cal A}$, are distinct. It is well known that the
largest such set is of size asymptotic to $N^{1/2}$. For a $B_2$ set ${\cal A}$
of this size we show that, under mild assumptions on the size of the modulus
$m$ and on the difference $N^{1/2}-\Abs{{\cal A}}$ (these quantities should not
be too large) the elements of ${\cal A}$ are uniformly distributed in the
residue classes mod $m$. Quantitative estimates on how uniform the distribution
is are also provided. This generalizes recent results of Lindstr\"om whose
approach was combinatorial. Our main tool is an upper bound on the minimum of a
cosine sum of $k$ terms, $\sum_1^k \cos{\lambda_j x}$, all of whose positive
integer frequencies $\lambda_j$ are at most $(2-\epsilon)k$ in size.
