import Foundation

func readInt() -> [Int]{
    return readLine()!.split(separator:" ").map{Int($0)!}
}

let nmv = readInt()
var A = readInt()
var B = readInt()
A.append(Int.max)
B.append(Int.max)
var time = nmv[2]
var c = -1
while(0 <= time){
  c += 1
  if(A[0] <= B[0]){
    time -= A[0]
    A.removeFirst()
  }else{
    time -= B[0]
    B.removeFirst()
  }
}
print(c)

