Hey Mariusz, I still have a question. In fact I realized that what I need is the values of this function, which is almost the same as the one in my first post expect that the xi go from 0 to d (where d>1 is a positive integer) instead of going from 0 to s:
f[k_, d_, s_] := Module[{c, x},
c = 0;
Do[
If[Sum[x[i], {i, 1, k}] == s, c++],
Evaluate[Apply[Sequence, Table[{x[i], 0, d}, {i, 1, k}]]]];
Return[c]];
I guess this is somewhat more complicated. Do you know the formula for this? Or someone else?
Merry Christmas