import collections


def find_encryption_weakness(numbers: list[int], target: int) -> int:
    """
    Finds the encryption weakness in O(n) running time
    where n is the size of the input list of numbers.
    """
    window = collections.deque()
    window_sum = 0
    for value in numbers:
        window.append(value)
        window_sum += value
        while window_sum > target:
            window_sum -= window.popleft()
        if len(window) >= 2 and window_sum == target:
            return min(window) + max(window)
    raise RuntimeError('cannot find a candidate')