Discrete Real Sinusoid Formula
In the first formula, $x[n]$ is written as if it were a sampled version of the continuous-time function

$$x_c(t)=A\cos(2\pi ft+\phi)\tag{1}$$

If you sample $(1)$ at $t=nT$, $n\in\mathbb{Z}$, you get the first formula. $T$ is the sampling period, or the inverse of the sampling frequency $f_s=1/T$.

If you compare the two formulas in your question you see that $fT=k/N$. Assuming that $k$ and $N$ are integers, then the second formula is a special case of the first one. The discrete-time signal obtained by sampling $(1)$ is not necessarily periodic. However if $fT$ is rational, as in your second formula, then $x[n]$ is periodic with period $N$.