add sum method for arrays