I just want to know if this equation for the mass defect is correct

$$\Delta m = Z * m_p + Z * m_e + N* m_n - A
$$

where 

 - Z- Atomic number
 - A- Mass number
 - N- number of neutrons
 - $m_p$- mass of the proton
 - $m_n$- mass of the neutron
 - $m_e$- mass of the electron

I came up with another formula also
$$ΔM=[(Z(m_p)+N(m_n))−(M)]$$
where m is the observed mass

Which one is correct and what is the difference between both these equations.