Driver code
var arr1 = [ 1 , 2 , 3 , 4 , 7 , 9 ] ; var arr2 = [ 0 , 1 , 2 , 1 , 1 , 4 ] ; var k = 2 ; var m , n ; m = arr1 . length ; n = arr2 . length ; document . write ( findSumofEle ( arr1 , m , arr2 , n , k ) ) ;