Given n integers between [0,10000] as D1,D2...,Dn, where there may be duplicates, and n can be huge:
I want to find k distinct represent
You may want to look into Ward's method using your particular distance function.