Create an empty Access_code list.
Loop through list B (make sure it’s sorted ascending by code)
When code != current user code, add object to the new list
When code = current user code, break out of the loop
The created list should now contains all Access_codes before your user’s code.