```python
def find_missing(ar, N):
    """
    Finds the missing number in a sorted array of unique integers from 1 to N.
    It is assumed that the array `ar` contains numbers from 1 to N with exactly
    one number missing, which implies len(ar) == N - 1.
    The function uses binary search for an efficient O(log N) solution.
    """
    low = 0
    high = len(ar) - 1

    # The binary search aims to find the first index where the element
    # does not match its expected value (index + 1).
    while low <= high:
        mid = low + (high - low) // 2
        # If the element at mid is at its correct position, the missing
        # element must be in the right half of the array.
        if ar[mid] == mid + 1:
            low = mid + 1
        # If the element at mid is not at its correct position, the missing
        # element is either at this index or in the left half.
        else:
            high = mid - 1

    # After the loop, `low` is the index where the sequence of consecutive
    # numbers breaks. The missing number is therefore `low + 1`.
    # This logic correctly handles cases where the missing number is 1, N,
    # or any number in between.
    return low + 1
```