"elmdist" is supposed to be an array of size "processes+1".