function main(input){
  const [l1, l2, l3] = input.split('\n');
  let [N, M, K] = l1.split(' ');
  let aArray = l2.split(' ');
  let bArray = l3.split(' ');
  const aArrayLenOri = aArray.length;
  const bArrayLenOri = bArray.length;
  while(K > 0 && (aArray.length > 1 || bArray.length > 1)) {
    const aTime = (aArray.length === 0) ? 0 : aArray[N - 1];
    const bTime = (bArray.length === 0) ? 0 : bArray[M - 1];
    if (aTime < bTime) {
      K - aTime;
      aArray.pop();
    } else {
      K - bTime;
      bArray.pop();
    }
  }
  console.log((aArrayLenOri - aArray.length) + (bArrayLenOri - bArray.length));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
