You need to define dp[0] and dp[1]. dp[0] tells you the answer for to , which means no number is present to choose, so dp[0] = 0.
When you consider dp[1], you have to consider from to , the only possible value is a[1]. You can either take it or not take it. The best is to take it, so dp[1] = a[1].
Now, think about the final answer!