An integrality criterion for elliptic modular forms