1989 AIME Problem 11

A sample of 121 integers is given, each between 1 and 1000 inclusive, with repetitions allowed. The sample has a unique mode (most frequent value). Let D be the difference between the mode and the arithmetic mean of the sample. If D is as large as possible, what is \lfloor D\rfloor ? (For real x,\lfloor x\rfloor is the greatest integer less than or equal to x.)