function [xest, norm_save] = OMP_CS(K,Phi,y)

[m,N]=size(Phi);
y_r = y;in = 0;
curr_index = [];

while in<K
   in = in+1;
   cv = abs( y_r'*Phi );
   [iv, id] = max(cv);
   curr_index =unique([curr_index, id]);
   Phi_x = Phi(:,curr_index);
   x_p = inv(Phi_x'*Phi_x)*Phi_x' * y;
   y_r = y - Phi_x*x_p;
   norm_save(in) = norm(y_r);
end
xest=zeros(N, 1);
xest(curr_index,1)=x_p;
return