(1) the following new paragraph: (2) Coordination with carryforward of account balances The dollar amount otherwise in effect under paragraph (1) for any plan year shall be reduced (but not below zero) by the excess (if any) of— (A) the amount of any account balance which is carried forward to such plan year from the preceding plan year, over (B) twice the dollar limitation in effect under paragraph (1) (determined without regard to this paragraph). . (2) Conforming amendments Section 125(i) of such Code is amended by striking taxable year each place it appears in paragraphs (1) and (3) (as redesignated by paragraph (1) of this subsection) and inserting plan year . (c) Coordination with cafeteria plan limitation on deferred compensation Section 125(d)(2) of such Code is amended by adding at the end the following new subparagraph: (E) Exception for health flexible spending arrangements Subparagraph (A) shall not apply to a plan to the extent of amounts in a health flexible spending arrangement which may be carried forward as described in section 106(h). . (d) Effective date The amendments made by this section shall apply to plan years beginning after December 31, 2018. 3. Individuals entitled to part A of Medicare by reason of age allowed to contribute to health savings accounts (a) In general Section 223(c)(1)(B) of the Internal Revenue Code of 1986 is amended by striking and at the end of clause (ii), by striking the period at the end of clause (iii) and inserting , and , and by adding at the end the following new clause: (iv) entitlement to hospital insurance benefits under part A of title XVIII of the Social Security Act by reason of section 226(a) of such Act. . (b) Conforming amendment Section 223(b)(7) of such Code is amended by inserting (other than an entitlement to benefits described in subsection (c)(1)(B)(v)) after Social Security Act . (c) Effective date The amendments made by this section shall apply to months beginning after December 31, 2018, in taxable years ending after such date. 4. Maximum