dp with dimensions n x (k+1) and a cumulative sum array cumulativeSum with the same dimensions, both filled with zeros.dp[i][0] to 1 for all i because there is always 1 way to draw 0 segments.n (1-indexed).i, iterate over the number of segments j from 1 to k.dp[i][j] by adding the number of ways to draw j segments using i-1 points and the cumulative sum of ways to draw j-1 segments up to point i-1.dp[i][j].dp[n][k] modulo 1e9+7.