Jane spent $40 on flowers. Each small flower cost $2, and each large flower cost $3. Write an equation that describes the relationship between cost and number of flowers purchased, where X is the number of small flowers and Y is the number of large flowers.