function trms=calcnumterms(P,m)

trms = zeros(1,P);

for p=1:P
    trms(p) = factorial(p+m-1)/factorial(p)/factorial(m-1);
end;    

trms = fliplr(trms);

return;

% if P==1
%     trms = ones(1,M);
% else
% 
%     P = P-1;
% 
%     Mp = M+1;
%     PSI = zeros(P,Mp);
% 
%     PSI(1,:) = Mp:-1:1;
%     PSI(:,end) = ones(P,1);
% 
%     for l=2:P
%         for c=Mp-1:-1:1
%             PSI(l,c) = PSI(l-1,c)+PSI(l,c+1);
%         end;    
%     end;
% 
%     trms = PSI(end,1:end-1);
%     
% end;
