State tax questions

I work for a company in New York (NY) throughout the year of 2021. I lived in NJ for the first 10 months of 2021 and lived in CA for the last two months. When file CA tax return, it ask me to fill in the amount that taxed by CA and other states. So, I filed in X amount (showed in my W2 CA state wages part for my last two months income of 2021) as taxed by CA and the same X amount as taxed by NY (my year total NY income is 6X which is X divide by 2 then multiply by 12). However,  on the next page, it asked me to fill in the following fields: income tax paid to NY and AGI taxed by New York. How should I fill in these two fields? Should I fill in something only related to my income of the last two month while living in CA and working for NY company, or should I fill in the income for the whole year while I work for the company in NY? How should I calculate (or find) these two numbers?

 

 

Screen Shot 2022-03-07 at 11.30.10 PM.png