import scala.math

object Main extends App {
  val sc = new java.util.Scanner(System.in)
  var n , m , k = sc.nextInt()
  var a = Array.fill(n)(sc.nextInt())
  var b = Array.fill(m)(sc.nextInt())
  var ans = 0
  var co = 0
  while (ans + math.min(a(0),b(0)) < k & co < a.length + b.length){
    ans = ans + math.min(a(0),b(0))
    if (a(0) > b(0)) {b.drop(1) }else{ a.drop(1)}
    co += 1
  }
  println(co)
}
