PLEASE CHECK EDIT $2$. It best explains my problem.
I know this question may be dumb but I have been working on it for over a day now and I can't seem to find any lead. So the question goes as follows:
We know that 1 + ${ x }_{ 1 }$ + ${ x }_{ 2 }$ + ${ x }_{ 3 }$ + ${ x }_{ 1 }{ x }_{ 2 }$ + ${ x }_{ 1 }{ x }_{ 3 }$ + ${ x }_{ 2 }{ x }_{ 3 }$ + ${ x }_{ 1 }{ x }_{ 2 }{ x }_{ 3 }$ = $\left( { 1+x }_{ 1 } \right) \left( { 1+x }_{ 2 } \right) \left( { 1+x }_{ 3 } \right) $. This can also be generalized for $x_n$. But I am looking for a formula that would give me only the sum of terms whose degree is atmost $k$. What I mean by degree in this context is, $x_1x_2x_3...x_6$ has a degree $6$. So, is it possible to generalize sum of that partial sequence? I looked up at many generating function articles but couldn't find anything. Please help me.
EDIT 1- More Clarification:
Let's say the sequence is
$1 + x_1 + x_2 + x_3 + x_4 + x_1x_2 + x_1x_3 + x_1x_4 + x_2x_3 + x_2x_4 + x_3x_4 + x_1x_2x_3 + x_1x_2x_4 + x_1x_3x_4 + x_2x_3x_4 + x_1x_2x_3x_4$
Now, its sum is $(1 + x_1)(1 + x_2)(1 + x_3)(1 + x_4)$.
If $k=2$, I want to find the sum of only those terms, whose degree is atmost $2$: The terms with degree less than or equal to $2$ are:
$1 + x_1 + x_2 + x_3 + x_4 + x_1x_2 + x_1x_3 + x_1x_4 + x_2x_3 + x_2x_4 + x_3x_4$
So, is it possible to generalize this for some $k$?
EDIT 2: The best representation of my problem. Thanks to mvxxx
If $F(S,t)=[t^k](1+a_1t)(1+a_2t)(1+a_3t)⋯(1+a_nt)$
for example:
$F({a,b,c},2)=$
$[t^2](1+at)(1+bt)(1+ct)=$
$[t^2](abct^3+t^2(ab+ac+bc)+t(a+b+c)+1)=$
$ab+ac+bc$
And $G(S,k)=\sum_{i=0}^{k}F(S,i)$
I am looking for solving $G(S,k)$ in $O(k\ logk)$ or better.