Superconformal indices, matrix integrals, and duality