In a small town, two bakeries, A and B, have a promotional sale on their most popular pastries. Bakery A sells pastries for $2 each, while Bakery B sells them for $3 each. Together, they want to sell a total of 500 pastries over the course of two days. On the first day, Bakery A sold three times as many pastries as Bakery B. On the second day, Bakery B sold 50 more pastries than Bakery A.
Let $x$ represent the number of pastries sold by Bakery B on the first day, and $y$ represent the number of pastries sold by Bakery A on the first day. Set up a system of linear equations to find the total number of pastries sold by Bakery A on the second day. Your answer should be a whole number.