Wow. This problem is really cool. Try using the naive method and you're sure to get TLE#26. Well, my solution(AC 0.234) goes this way:
if the first term is not 1 then the ans is 1. if the first i terms are 1<<0, 1<<1, 1<<2, ... 1<<(i-1) then all numbers from 1 to (1<<i) - 1 can be expressed as a sum of some of the above terms. Thus if a number k is present all numbers from k to k+((1<<i) - 1) can be skipped. Proceed using this approach.