process.stdin.resume();
process.stdin.setEncoding('utf8');

var input_lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

var row = 0
reader.on('line', (line) => {
  var column = line.split(" ")
  var new_input_lines = []
  for(var i=0;i<column.length;i++){
      new_input_lines[i] = parseInt(column[i]);
  }
  input_lines.push(new_input_lines)
});

reader.on('close', () => {
  //console.log(input_lines);
  var a_book = input_lines[1], a_turn = 0;
  var b_book = input_lines[2], b_turn = 0;
  var total_time = input_lines[0][2];
  var sum_time = 0;
  var sum_book = 0;

  while(true){
    //console.log("A = " + a_book[a_turn]);
    //console.log("B = " + b_book[b_turn]);
    if(a_book[a_turn] != null && b_book[b_turn] != null){
      if(a_book[a_turn] <= b_book[b_turn]){
        sum_time += a_book[a_turn];
        //console.log(sum_time);
        a_turn ++;
      } else {
        sum_time += b_book[b_turn];
        //console.log(sum_time);
        b_turn ++;
      }
      if(sum_time <= total_time){
        sum_book ++;
      } else {
        break;
      }
    }
    if(a_book[a_turn] != null && b_book[b_turn] == null){
      sum_time += a_book[a_turn];
      //console.log(sum_time);
      a_turn ++;
      if(sum_time <= total_time){
        sum_book ++;
      } else {
        break;
      }
    }
    if(a_book[a_turn] == null && b_book[b_turn] != null){
      sum_time += b_book[b_turn];
      //console.log(sum_time);
      b_turn ++;
      if(sum_time <= total_time){
        sum_book ++;
      } else {
        break;
      }
    }
    if(a_book[a_turn] == null && b_book[b_turn] == null){
      break;
    }
  }

  console.log(sum_book);


});
