def least_common_values(array, to_find):
    """
    >>> least_common_values([1,1,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4], 2)
    [(1, 2), (2, 4)]
    """
counts = collections.Counter(array)
return list(reversed(counts.most_common()[-to_find:]))
Python 3.1 - Obtaining the least common element in array