Application of the inhomogeneous Kibble-Zurek mechanism to quench dynamics in the transition from a Mott insulator to a superfluid in a finite system