The value bi itself suggests a block length L. Using that L, you can try two roles for bi:
• It might be the length at the right end of a block.
• It might be the length at the left end of a block. Each of these cases tells you how you can jump from one prefix length to another. The whole problem becomes a reachability question on prefix positions:
• Position 0 means the empty prefix.
• You start from prefix 0.
• You make jumps according to valid blocks.
• If you can reach prefix n, then the answer is YES, otherwise NO. That is exactly what you will represent with dynamic programming.