US, Afghan officials reach deal over long-term presence