What loss function does K-Means seek to minimize?

K-Means minimizes the total within-cluster sum of squares (WCSS), meaning that it penalizes observations that lie far away from the centroid of the cluster to which they are assigned more so than those close to the centroids. K-Means does not require a specific choice of distance metric, but the Euclidean distance is used most often.