<s>[INST] Is there a formula for computing the number of arrangements from a set of N elements groupped in K groups? Eg: N=3, K=2
There will be two groups in each solution. We need to calculate the number of such possible solutions. Consider the set S={1,2,3}. The possible solutions are:
{1} {2,3}
{1} {3,2}
{2} {1,3}
{2} {3,1}
{3} {1,2}
{3} {2,1}
{1,2} {3}
{2,1} {3}
{1,3} {2}
{3,1} {2}
{2,3} {1}
{3,2} {1}

The result for this example is: 12.
Eg: N=4, K=3
{1} {2} {3,4}
{1} {2} {4,3}
{1} {2,3} {4}
{1} {3,2} {4}
....

Can we generalize this formula?
 [/INST] We assume that the example for $N=3$, $K=2$ is correct, meaning that the internal order of the elements in individual groups matters.
There are $N!$ ways of lining up our $N$ objects. That produces $N-1$ interobject "gaps." We choose $K-1$ of them to put a separator into. 
That can  be done in $\binom{N-1}{K-1}$ ways, for a total of $N!\binom{N-1}{K-1}$.
Remark: If internal order within groups does not matter, the solution is quite different, and uses Stirling numbers of the second kind.
</s>