  Let $\mathcal{O}_K$ be the ring of integers of an algebraic number field $K$
embedded into $\mathbb{C}$. Let $X$ be a subset of the Euclidean space
$\mathbb{R}^d$, and $D(X)$ be the set of the squared distances of two distinct
points in $X$. In this paper, we prove that if $D(X)\subset \mathcal{O}_K$ and
there exist $s$ values $a_1,\ldots, a_s \in \mathcal{O}_K$ distinct modulo a
prime ideal $\mathfrak{p}$ of $\mathcal{O}_K$ such that each $a_i$ is not zero
modulo $\mathfrak{p}$ and each element of $D(X)$ is congruent to some $a_i$,
then $|X| \leq \binom{d+s}{s}+\binom{d+s-1}{s-1}$.
