fun main(args:Array<String>?): Unit {
    val (s, t, d) = readLine()!!.trim().split(' ').map(String::toLong)
    val weights = readLine()!!.trim().split(' ').map(String::toLong)
    val min = LongArray(weights.size){weights[it]}.let{a -> a.indices.drop(1).forEach{i -> a[i] += a[i - 1]}; a.min()!!}
    val sum = weights.sum()
    if (sum >= 0 && s + min > t) println(-1)
    else {
        if (s + min <= t) println(calFirstDay(s, t, weights))
        else {
            val loop = (t - s - min + sum + 1) / sum
            println(calFirstDay(s + sum * loop, t, weights)!! + loop * d)
        }
    }
}
fun calFirstDay(initial: Long, target: Long, weights: List<Long>): Int? {
    var current = initial
    for (i in weights.indices) {
        current += weights[i]
        if (current <= target) return i + 1
    }
    return null
}

