def all_k_element(elements, k):
    """
    A generator that produces all k-element subsets of the input elements in lexicographic order.

    :param elements: the input set
    :type elements: list
    :param k: size of the output set
    :type k: int
    :return: one of the k-element subsets of the input set
    :rtype: list
    """
    n = len(elements)
    a = list(range(k))
    h = 0
    done = False
    first = True
    while not done:
        if not first:
            h = 0 if a[k - h - 1] < n - h - 1 else h + 1
            a[k - h - 1] += 1
            for j in range(k - h, k):
                a[j] = a[j - 1] + 1
        done = k == 0 or k == n or a[0] == n - k
        first = False
        yield list(map(lambda x: elements[x], a))
