Why the calculated value of power is not match?

I am trying to calculate the power of a signal by using following two methods one is a power of a signal and another one is using the periodogram in Matlab as shown in the code.But why I am getting a different answer for the power?

x=[1 2 3 4 ];

s=0;

for i=1:length(x)
s=s+x(i).^2;
end

p=s/length(x);

D=fft(x);

P= sum((abs(D).^2)/length(x));


p=7.5, P=30

These are the formulas for both methods.