finding items in one array based upon a second array,A[B == x].sum()