'use strict';
let int_input_list = [];
let count = 0;

// let answer;
function main(input) {
  const str_list = input.replace(/\r?\n/g," ").split(" ");

  for (let i = 0; i < str_list.length; i++){
    str_list[i] = parseInt(str_list[i])
    int_input_list.push(str_list[i])
  }
  
  let books_minutes = []
  books_minutes = int_input_list.slice(3)
  
  let num_of_books_on_the_desk = int_input_list[0]+int_input_list[1]
  
  //console.log('int_input_list: ', int_input_list) 
  //console.log('books_minutes: ',books_minutes)
  
  let max_minutes = int_input_list[2]
  
  // sort each books' minutes
  books_minutes.sort(function(a, b) {
  return a - b;
});
  
  
  let num_of_books_read = 0
  let sum_of_minutes = 0
  //console.log(books_minutes);
  for (let z=0; z < num_of_books_on_the_desk; z++ ){
    
    sum_of_minutes = sum_of_minutes + books_minutes[z];
	//console.log(z)
    num_of_books_read = z
	//console.log(z)

  }
  console.log(num_of_books_read)
  };
  

 
main(require('fs').readFileSync('/dev/stdin', 'utf8'))