Localization on the D-brane, two-dimensional gauge theory and matrix models