Yes, it is in both but we have to be careful not to double count:
The Fed’s definition of M1 is the sum of (1) currency outside bank
vaults, (2) traveler's checks of nonbank issuers, (3) customers’demand
deposits at commercial banks (with minor deductions), and (4) other
checkable deposits, like negotiable order of withdrawal (NOW) and
automatic transfer service (ATS) accounts. Basically, this is currency
held by the public plus demand deposit balances outside the Fed. M2
consists of M1 plus (1) savings deposits (including money market
deposit accounts), (2) small-denomination time deposits (less than
$100,000), and (3) balances in retail money market mutual funds.
Individual retirement account (IRA) and Keogh account balances are
excluded from M2. Excess reserves, required reserves, clearing
balances held at the Federal Reserve banks, and the like, are
components of the Fed’s monetary base but would constitute
double-counting of the same factors if included in M1 and other
monetary aggregates. Such accounts are readily spendable media of
exchange (transaction accounts), but counterparts of these accounts
already are included in M1, for example, as components of customers’
demand deposits at commercial banks. The quantities of liquidity to
fear for inflationary consequences are either monetary base or M1/M2,
but not both simultaneously.
The Problem of Excess Reserves, Then and Now (Todd (2013))
What is the monetary base?
In economics, the monetary base (also base money, money base,
high-powered money, reserve money, outside money, central bank money
or, in the UK, narrow money) in a country is defined as the portion of
the commercial banks' reserves that are maintained in accounts with
their central bank plus the total currency circulating in the public
(which includes the currency, also known as vault cash, that is
physically held in the banks' vault).
The monetary base should not be confused with the money supply which
consists of the total currency circulating in the public plus the
non-bank deposits with commercial banks.
Wikipedia: Monetary base
This is how it works:
Creating Money through the Discount Window. When a bank needs new
reserves to support loans and investments it has already made or
anticipates making, it ordinarily borrows from other banks at the
Federal Funds rate. But during times of stress, which are reflected
by a shortage of liquidity in many banks, the whole banking system
needs new reserves — hence the Fed's discount window. When a bank
borrows funds overnight from the Fed's discount window (at an interest
rate the Fed sets, called the discount rate), the bank's reserve
account at the Fed is credited with the amount borrowed (and the Fed
adds to its assets the additional amount owed to it by the borrowing
bank). Since the borrowing bank gets new reserves and no other bank
lost reserves, net new reserves have been created for the banking
system as a whole. If the amount is also \$10 million, the banking
system as a whole has a new capacity to expand loans and deposits by
as much as \$100 million. Thus, the Fed's open market purchases and
discount window loans have the same ultimate impact on the money
supply, at least until the discount window loans are repaid.
How the Fed Creates Money (McTeer and Villarreal (2008))