here is cost function which I want to minimize it by using Lagrangian, but something is different from the previous problem that I solved. here the "subject to" part is a member of some set and I don't know how can I solve this problem with this subject form.

any Idea would be appreciated.
This problem has nothing to do with Lagrangians, as it is a discrete optimization problem.
Given $n$ points in ${\mathbb R}^d$, $\>d\geq1$, the function $$J(y):=\sum_{k=1}^n|x_k-y|^2$$ is minimized iff $y$ is the centroid of the $x_k$, i.e., iff $$y={1\over n}\sum_{k=1}^n x_k=:x_*\ .$$ In the case at hand we are not allowed to choose $y:=x_*$; instead we have to choose $y:=x_k$ for some $k\in[n]$. Replacing $x_*$ by $x_k$ results in the extra cost $n\,|x_*-x_k|^2$ (this is essentially the parallel axis theorem). In order to make this extra cost minimal we choose $k_*\in[n]$ such that $|x_{k_*}-x_*|$ is minimal, and put $y_*:=x_{k_*}$. The resulting value of $J$ then is $$J(y_*)=\sum_{k=1}^n|x_k-x_*|^2 +n\,|x_{k_*}-x_*|^2\ .$$