Calculate shared key having A public Key and B private Key (Diffie Hellman) I cannot understand how this works. 

$\text{A}_\text{public} = g^a \bmod p$

$\text{B}_\text{private} = \text{B}$

$\text{g} = p$

I also have $p$, I need to get the shared key, that I know both $\text{A}$ and $\text{B}$ get exactly the same value. Im not understanding how can I get the shared key that $\text{B}$ generated only having those variables I wrote above.

Also I know that the shared key is $\text{g}^\text{ab} \bmod p$, how can I get that $\text{b}$ value?
$\text{B}_\text{private}$ is $\text{b}$ and $\text{B}_\text{public}$ is $\text{g}^\text{b} \bmod p$.

So $\text{B}$ can compute $(\text{A}_\text{public})^b \bmod p = \text{g}^{\text{ab}} \bmod p$