C++ solution using Kadane's Algo
\nint kConcatenationMaxSum(vector<int>& arr, int k) {\n\tlong long ans=0,curr=0,last;\n\t// Apply kadane\'s algo by traversing over the array two times to know 
```\nint kConcatenationMaxSum(vector<int>& arr, int k) {\n\tlong long ans=0,curr=0,last;\n\t// Apply kadane\'s algo by traversing over the array two times to know the pattern\n\t// If at the end of second traversal, if sum (curr variable is storing the sum) is greater than what we get from 1st travresal then this means that (k-2) arrays when concatenated will always increase our sum\n\t// else our answer will be from first 2 arrays or traversal\n\tfor(int i=1;i<=k && i<=2;i++){\n\t\tlast=curr;  // storing sum of 1st traversal\n\t\tfor(auto ele:arr){\n\t\t\tcurr=curr+ele;\n\t\t\tif(curr<ele){\n\t\t\t\tcurr=ele;\n\t\t\t}\n\t\t\tans=(max(ans,curr))%1000000007;\n\t\t\tcurr%=1000000007;\n\t\t}\n\t}\n\t// let the sums we got after 1st and 2nd traversal are 5 and 10 respectively.\n\t// Here, there is increase of 5 in sum(10-5=5). So when the remaining k-2 arrays are concatenated, the increase in sum will (k-2)*5\n\tif(curr-last>0 && k>1){\n\t\tans=(ans+((curr-last)*(k-2))%1000000007)%1000000007;\n\t}\n\treturn ans;\n}\n// Hit Upvote if you like... :)\n```
['C']