complexity of dividing set of number with constraints
The difficulty of your problem heavily depends on &quot;constraint&quot;.
For example if $n=3k$, $\text{size}=[\underbrace{3,3,3,...}_{k\text{ times}}]$, and the constraint is that the sum of the numbers each group must be equal, then your problem is strongly NP-hard since it is exactly $3$-partition.
The same problem with groups of size $2$ is polynomial.
Notice that both problems are in $\mathsf{NP}$ and that being in $\mathsf{NP}$ does not mean that the complexity to solve it is exponential.