In Good Sequence, sum of elements of every non-empty Subsequence should be divisible by m.

Consider seq=[2,4,3,6] and m=2. There are 3 elements divisible by m but one isn’t. So, I can give you some sub sequences of seq such that sum of elements of the sub sequence isn’t divisible by m. Examples of such sub sequences are [2,3], [3], [2,3,6] ... and more. So, we can prove if a sequence has atleast 1 element that isn’t divisible by m, the seq definitely isn’t a good one.

Now can we prove the reverse? Consider a seq having all elements divisible by m. Is it always a good one? Yes! If a \% m=0 and b \% m=0 , then (a+b) \% m=0.

Now Question asks how many Sub sequence of a given sequence are good. A Sub sequence of a given seq will be good iff it has all the elements divisible by m. Take all the elements of the seq divisible by m. and we can either put or not put it in the Sub sequence.

seq=[2,4,3,6] and m=2

k=3

Candidate elements - [2,4,6] in order as they appear in the seq.

Notice the sub sequences will be 2^k (Notice the leaves of the tree). Since good seq has positive number of elements, ans will be 2^k-1.