title: Find point which sum of distances to set of other points is minimal
body: <p>I have one set (X) of points (not very big let's say 1-20 points) and the second (Y), much larger set of points. I need to choose some point from Y which sum of distances to <strong>all</strong> points from X is minimal. </p>
  
  <p>I came up with an idea that I would treat X as a vertices of a polygon and find centroid of this polygon, and then I will choose a point from Y nearest to the centroid. But I'm not sure whether centroid minimizes sum of its distances to the vertices of polygon, so I'm not sure whether this is a good way? Is there any algorithm for solving this problem?</p>
  
  <p>Points are defined by geographical coordinates.</p>