\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{bigdelim}

\newcommand\undermat[2]{%
	\makebox[0pt][l]{$\smash{\underbrace{\phantom{%
					\begin{matrix}#2\end{matrix}}}_{\text{$#1$}}}$}#2}

\begin{document}

\begin{align*}
A_{k} &= \left.\left(
\begin{array}{ccc|ccc}
1 &  &  & 0\\
 & \ddots &  &  & \ddots\\
 &  & 1 &  &  & 0
\end{array}
\right)\right\}N+1\\[-0.5\normalbaselineskip]
      & \hspace{2em}\underbrace{\hspace{2cm}}_{N+1} 
        \hspace{\tabcolsep}
        \underbrace{\hspace{1.7cm}}_{2N+1}
 \end{align*}
 
\begin{align}
 	\begin{array}{cccc|ccccc}
 	\ldelim({7}{*} &d_1 &&&&&& \rdelim){7}{*}& \\
 	&& \ddots &&&&&& \\
 	&& & d_r &&&&&\\ \cline{2-7}
 	&&&& 0&&&& \rdelim\}{3}{*}[$m-r$] \\
 	&&&&& \ddots&&& \\
 	&&&& \undermat{n-r}{&& 0&&}
 	\end{array}\notag
\end{align}
 

 

\end{document}