def order(alpha, p):
    """
    Determines the order of an element

    :param alpha: the element we want to find the order of
    :param p: the prime modulus

    :returns: the order of alpha
    """
    count = 1
    x = alpha
    while x != 1:
        x = (x * alpha) % p
        count += 1

    return count