M-theory on Elliptic Calabi-Yau Threefolds and 6d Anomalies