Consider a hypothetical scenario where two countries, Country A and Country B, engage in trade of two goods, X and Y. Initially, both countries have identical production possibilities frontiers (PPFs) for X and Y. However, Country A experiences a technological advancement that increases its productivity in producing good X. Analyze the potential effects of this technological advancement on the terms of trade, relative prices, and welfare of both countries. Additionally, discuss the implications for income distribution within each country and propose potential policy responses to address any adverse effects on certain groups.