The sum of the ages of the two teachers is 62 years.
To find this, we can use the following steps:
The total age of the 30 boys is 450 years.
The total age of the 30 boys and the two teachers is 512 years.
Therefore, the sum of the ages of the two teachers is 512 - 450 = 62 years.