Υǥ쥯ȥκ


(Y,0,[]).
(Y,N,[A|X]) :-
        select(A,Y,Z),
        succ(M,N),
        (Z,M,X).