When solving for the Klein-Gordon field $\phi$, most texts and online resources that I look at say that: $$\phi(x) = \int \frac{ d^{3} p }{ ( 2 \pi )^{3} } \frac{1}{\sqrt{ 2 E_{\mathbf{p}} }} \left[ a_{\mathbf{p}} e^{-ip\cdot x} + a_{\mathbf{p}}^{\dagger} e^{ip\cdot x} \right]\tag{1}$$
In this case, we'd have $$[a_{\mathbf{k}}, a_{\mathbf{p}}^{\dagger}]=(2\pi)^{3}\delta^{(3)}(\mathbf{k} - \mathbf{p}).$$
$\ $
However, my teacher right now has given me a solution $\phi$ such that:
$$\phi(x) = \int \frac{ d^{3} p }{ ( 2 \pi )^{3} } \frac{1}{2 E_{\mathbf{p}} } \left[ a_{\mathbf{p}} e^{-ip\cdot x} + a_{\mathbf{p}}^{\dagger} e^{ip\cdot x} \right]\tag{2}$$
Note the lack of square root here! In this case, I believe we'd have $$[a_{\mathbf{k}}, a_{\mathbf{p}}^{\dagger}]=(2\pi)^{3}2E_{\mathbf{k}}\delta^{(3)}(\mathbf{k} - \mathbf{p}).$$
$\ $
Both of these seem valid, and so to me it seems like the factor in front of the bracket is free for us to choose (as long as it makes $\phi$ Lorentz invariant). Is this correct? Or, what is going on?