% 1.

% subsetN(l1..ln, k) = [], k = 0
%                      l1 + subsetN(l2..ln, k - 1), k > 0
%                      subsetN(l2..ln, k), k > 0



subsetN([X|Xs],[X|Ys],N):-
    N>0,
    N1 is N - 1,
    subsetN(Xs,Ys,N1).
subsetN([_|Xs],Ys,N):-
    N>0,
    subsetN(Xs,Ys,N).
subsetN(_,[],0).

subset(X,N,R):-
    findall(Y,subsetN(X,Y,N),R).

