Inaho IX
View as PDFInaho is given a function:
Given  and 
, Inaho wants you to print 
.
Input Specification
The first line will contain two integers,  
.
The second line will contain  integers, 
 
.
Output Specification
Print .
Subtasks
Subtask 1 [10%]
Subtask 2 [30%]
Subtask 3 [60%]
No additional constraints.
Sample Input 1
2 5
1 1
Sample Output 1
5
Sample Input 2
6 90000
4 2 29 5 1 10
Sample Output 2
408918679
Comments