How many possible arrangements of dominoes on a line? Let`s imagine a line of N fields (a 1-dimensional grid).
□□□□□□□□□□□□...
Now we take n dominoes (each domino is m fields long, e.g m=3 □□□ ).
(I`m aware that 'domino' is for m != 2 wrong, but that makes the description easier)
How many possible arrangements of dominoes are possible?
---> The dominoes may not overlap with each other.
---> The dominoes may not overlap with the beginning/first field.
---> BUT dominoes MAY overlap with the end/last field.
EXAMPLE:
N = 5 (□□□□□)
n = 2 (■■ und ◘◘)
m = 2
These 12 arrangements are possible:
■■◘◘□
■■□◘◘
■■□□◘◘
□■■◘◘
□■■□◘◘
◘◘■■□
□□■■◘◘
◘◘□■■
□◘◘■■
◘◘□□■■
□◘◘□■■
□□◘◘■■

Arrange the dominoes in some order, which can be done in $n!$ ways.
Now take the $N$ fields plus the $m\!-\!1$ "phantom fields" at the end, remove those $nm$ covered by the dominoes, and allocate those amongst the dominoes for ${N+m-1-nm+n \choose n}$ choices.
Overall:$$n!{N+n+m-1-nm \choose n} = n!{N- (n\!-\!1)(m\!-\!1) \choose n} $$
For your example, this gives $2!{5-1 \choose 2} = 12$ as expected
