Find second acid dissociation constant at a given pH
For starters, I’m going to define your molecule as being $\ce{HA}$ and its two ionised forms to be $\ce{A-}$ and $\ce{H2A+}$. This means, we are observing the following equilibrium:

$$\ce{H2A+ &lt;=&gt;[H+] HA &lt;=&gt;[H+] A-}$$

As you correctly calculated, you have $10~\mathrm{mmol}$ of $\ce{H_nA^m+}$ and $12~\mathrm{mmol}\ \ce{HCl}$ that you add to your solution.

$12~\mathrm{mmol} &gt; 10~\mathrm{mmol}$. Thus, there are two possibilities:


we started with $10~\mathrm{mmol}\ \ce{HA}$. We ended up with $10~\mathrm{mmol}\ \ce{H2A+}$ and $2~\mathrm{mmol}\ \ce{HCl}$
we started with $10~\mathrm{mmol}\ \ce{A-}$. We ended up with $8~\mathrm{mmol}\ \ce{HA}$ and $2~\mathrm{mmol}\ \ce{H2A+}$


$\mathrm{pH}~7.4$ is only consistent with possibility 2; in case of 1 it would mean $2~\mathrm{mmol}\ \ce{HCl}$ controlling the $\mathrm{pH}$ which would give us $\mathrm{pH} &lt; 3$. Thus, we are well within the operating scheme of $\mathrm{p}K_\mathrm{a,1}$ and we can easily use the Henderson–Hasselbalch equation:

$$\begin{align}\mathrm{pH} &amp;= \mathrm{p}K_\mathrm{a} + \log \frac{[\ce{HA}]}{[\ce{H2A+}]}\\
7.4 &amp;= \mathrm{p}K_\mathrm{a} + \log \frac{\frac{8~\mathrm{mmol}}{V}}{\frac{2~\mathrm{mmol}}{V}}\\
7.4 &amp;= \mathrm{p}K_\mathrm{a} + \log 4\\
7.4 &amp;= \mathrm{p}K_\mathrm{a} + 0.60\\
6.8 &amp;= \mathrm{p}K_\mathrm{a}\end{align}$$



You did indeed identify the spot where you went wrong. Just because a compound is dibasic does not mean you should double its concentration. As I showed above, $10~\mathrm{mmol}$ of original molecule, whether it was entered as $\ce{H2A+}, \ce{HA}$ or $\ce{A-}$ will remain $10~\mathrm{mmol}$; only the number of attached protons will differ.