Bash Frog River One
frog_river_one() {
    local _x=$1
    local -n _a="$2"
    local -A _existing
    local _k _v
    for _k in "${!_a[@]}"; do
        _v=${_a[$_k]}
        if [[ -z "${_existing[$_v]:-}" ]] && (( _v <= _x )); then
            _existing[$_v]=1
            if (( ${#_existing[@]} == _x )); then
                echo "$_k"
                return
            fi
        fi
    done
    echo -1
}

This tracks the earliest time each needed position appears and stops as soon as the frog can cross.