You are given N numbers placed in a line. You have to select K numbers from those numbers. The priority level of the numbers is different.
You can select numbers from end only. After selection the number gets erased from the line. You want to maximize the sum of priority level of all the numbers. Your task is to find the maximum sum of the priority values.
Input format
First line contains K and N.
Second line contains N space separated integers denoting the priority of numbers in the list.
Output format
Maximum sum of priority of K numbers
Constraints
1≤K≤N≤105
0≤Ai≤109
Sum of priorities will be maximised if he selects 4th chocolate first , followed by 3rd one