US officials: Surveillance programs helped stop 50 terrorist plots