Find number of ways to select subset with distinct objects of at most K size.

I have a set of x number of 'A' type object, y number of 'B' type object and z number of 'C' type object. Now, I need to find the number of subsets of atmost 'k' size that can be made such that all the objects in subsets are distinct. No two same type of object will be in the same subset. The elements are same but their combinations are considered different.

Eg:- [1,1,5,5,4] and k = 3

Output:- 17

Explanation:-

[1], [1], [5], [5], [4] => 5

[1,5], [1,5], [1,5], [1,5], [1,4], [1,4], [5,4], [5,4] => 8

[1,5,4], [1,5,4], [1,5,4], [1,5,4] => 4

The number of subsets with one element is $$x+y+z$$. The number with two elements is $$xy+xz+yz$$. The number with three elements is $$xyz$$. The number with more than three elements is $$0$$.
• @Kamesh-Bakshi It's just the sum of the products of the numbers of elements of each type, taken $k$ at a time. Don't you see the pattern? – saulspatz Sep 9 '19 at 13:17