def pair_sum_in_array(array, x):
    """Check whether there is a pair of numbers in sorted array with sum = x."""
    l = 0
    r = len(array) - 1
    while l < r:
        if array[l] + array[r] == x:
            return True
        elif array[l] + array[r] < x:
            l += 1
        else:
            r -= 1
    return False