Question: Who did the former Deputy National Security Advisor to President Donald Trump lose the party nomination to for the United States Senate race for New York?

Context paragraphs:
Frances Townsend: Frances M. "Fran" Fragos Townsend (born December 28, 1961) is the former Homeland Security Advisor to United States President George W. Bush and a TV personality.  Townsend was appointed to this position by President Bush on May 28, 2004.  Her resignation was announced November 19, 2007.  She chaired the Homeland Security Council and reported to the President on homeland security policy and counterterrorism policy.  She previously served as Deputy Assistant to the President and Deputy National Security Advisor for Combating Terrorism.  In 2008, Townsend joined CNN as a contributor.  Townsend is president of the Counter Extremism Project.

Dina Powell: Dina Habib Powell (born Dina Habib Arabic: دينا حبيب‎ ‎ ; born June 12, 1973) is an Egyptian- and Coptic-American non-profit executive, philanthropist, and U.S. policymaker.  She is the current U.S. Deputy National Security Advisor for Strategy to President Donald Trump.

Tony Blinken: Antony John Blinken (born April 16, 1962) is the former United States Deputy Secretary of State and the former Deputy National Security Advisor for President Barack Obama.  He had served as a Senior Fellow at the Center for Strategic and International Studies, Democratic Staff Director of the United States Senate Committee on Foreign Relations (from 2002 to 2008), and a member of the Obama-Biden Presidential Transition team (from November 2008 to January 2009), among other positions.

Faryar Shirzad: Faryar Shirzad (in Persian: فریار شیرزاد‎ ‎ ); born 1965 in London formerly served on the staff of the National Security Council at the White House from March 2003 through August 2006, first as a special assistant to the President for International Economic Affairs, and then as deputy assistant to the President and deputy national security advisor for International Economic Affairs.  In those roles, Shirzad was responsible for advising the President, the National Security Advisor and the Director of the National Economic Council on all international economic policy matters, including trade, investment, finance, development, energy and environment.  He also served as the President’s personal representative to the G-8 (the “G8 Sherpa”), and led the preparations for the President’s participation in other international economic summits, such as the U.S.-E.U. Summit, the Asia Pacific Economic Cooperation Forum and the Summit of the Americas.

K. T. McFarland: Kathleen Troia "K.T." McFarland (born July 22, 1951) is an American government official and commentator who is the nominee to become the next United States Ambassador to Singapore.  McFarland served as Deputy National Security Advisor to President Donald Trump during the first months of 2017.

Homeland Security Advisor: The Assistant to the President for Homeland Security and Counterterrorism, commonly referred to as the Homeland Security Advisor and occasionally holding the title of Deputy National Security Advisor for Homeland Security and Counterterrorism, is a senior aide in the Executive Office of the President, based in the West Wing of the White House, who serves as the chief in-house advisor to the President of the United States on homeland security and counterterrorism issues.  The Homeland Security Advisor is a statutory member of the Homeland Security Council.  Serving at the pleasure of the President, the Homeland Security Advisor does not require Senate confirmation for appointment to the office.

Stephen Hadley: Stephen John Hadley (born February 13, 1947) was the 21st U.S. Assistant to the President for National Security Affairs (commonly referred as National Security Advisor), serving under President George W. Bush during the second term of his administration.  Hadley was Deputy National Security Advisor during the Bush's first term.  Before that Hadley served in a variety of capacities in the defense and national security fields.  He has also worked as a lawyer and consultant in private practice.

John O. Brennan: John Owen Brennan (born September 22, 1955) was the Director of the Central Intelligence Agency from March 2013 to January 2017.  He has served as chief counterterrorism advisor to U.S. President Barack Obama; his title was Deputy National Security Advisor for Homeland Security and Counterterrorism, and Assistant to the President.  His responsibilities included overseeing plans to protect the country from terrorism and respond to natural disasters, and he met with the President daily.  Previously, he advised President Obama on foreign policy and intelligence issues during the 2008 presidential campaign and transition.  Brennan withdrew his name from consideration for Director of the Central Intelligence Agency (CIA) in the first Obama administration over concerns about his support for transferring terror suspects to countries where they may be tortured while serving under President George W. Bush.  Instead, Brennan was appointed Deputy National Security Advisor, a position which did not require Senate confirmation.

Deputy National Security Advisor (United States): The Deputy Assistant to the President for National Security Affairs, also known as the Deputy National Security Advisor, is a member of the Executive Office of the President of the United States and the United States National Security Council, serving as deputy to the President's National Security Advisor.

United States Senate election in New York, 2006: The 2006 United States Senate election in New York was held November 7, 2006.  Incumbent Democratic U.S. Senator Hillary Rodham Clinton won, by a more than two-to-one margin, a second term representing New York in the United States Senate.  Clinton was challenged by Republican John Spencer, a former Mayor of Yonkers, New York.  Spencer won his party nomination by defeating former national security staffer K. T. McFarland in a primary.

Supporting paragraphs: United States Senate election in New York, 2006 K. T. McFarland
Answer: John Spencer