Let us consider two sequences:
$$n_k \in \Omega,\,k=1,2,...K,$$
$$m_k \in \Omega,\,k=1,2,...K,$$
where $$\Omega:=\{n\in\mathbb{N}|\,n\leq K\}.$$
Let us define
$$\sigma_n:=\sum_{k=1}^K k\, n_k,\,\sigma_m:=\sum_{k=1}^K k\,m_k$$
The task is to find all possible ##(n_k,\,m_k)## pairs such that...