loop do
    w, n = gets.split.map(&:to_i)
    break if w == 0
    xs = gets.split.map(&:to_i)

    min_max_space = [Float::INFINITY] * n

    s = xs[0]

    k = 1
    loop do
        s += xs[k]
        break if (w - s) / k < 1
        min_max_space[k] = ((w - s).to_f / k).ceil
        k += 1
        break if k >= n
    end

    if k >= n
        puts 1
        break
    end

    while k < n
        s = xs[k]
        i = k - 1
        l = 1
        loop do
            s += xs[i]
            break if (w - s) / l < 1
            mms = [((w - s).to_f / l).ceil, min_max_space[i-1]].max
            min_max_space[k] = mms if mms < min_max_space[k]
            i -= 1
            break if i == 1
            l += 1
        end
        k += 1
    end

    ans = Float::INFINITY
    s = -1
    (n-1).downto(0) do |i|
        mms = min_max_space[i]
        ans = mms if mms < ans
        s += 1 + xs[i]
        break if s > w
    end

    p ans
end