Choose the better values (in terms of range) for resistors in this non-inverting op-amp circuit
As you have figured out, the gain is only a function of the ratio of the two resistors.  Therefore, at first glance, 2 k&Omega; / 1 k&Omega;, and 2 M&Omega; / 1 M&Omega; are equivalent.  They are, ideally, in terms of gain, but there are other considerations.

The biggest obvious consideration is the current that the two resistors draw from the output.  At 15 V out, the 2k&Omega;/1k&Omega; combination presents a load of 3 k&Omega; and will draw (15 V)/(3 k&Omega;) = 5 mA.  The 2M&Omega;/1M&Omega; combination will likewise only draw 5 &micro;A.

What does this matter?  First, you have to consider whether the opamp can even source 5 mA in addition to whatever load you want it to drive.  Perhaps 5 mA is no problem, but obviously there is a limit somewhere.  Can it source 50 mA?  Maybe, but probably not.  You can't just keep making R1 and R2 lower, even keeping their ratio the same, and have the circuit continue to work.

Even if the opamp can supply the current for the R1+R2 value you picked, you have to consider whether you want to spend that current.  This can be a real issue in a battery operated device.  5 mA continuous drain may be a lot more than the rest of the circuit needs, and the major reason for short battery life.

There are other limits too at high resistances.  High impedance nodes in general are more susceptible to picking up noise, and high-value resistor have more inherent noise.

No opamp is perfect, and its input impedance not zero.  The R1 and R2 divider form a voltage source of impedance R1//R2 driving the inverting input of the opamp.  With 2M&Omega;/1M&Omega;, this parallel combination is 667 k&Omega;.  That needs to be small compared to the opamp's input impedance else there will be significant offset error.  The opamp input bias current must also be taken into account.  For example, if the input bias current is 1 &micro;A, then the offset voltage caused by the 667 k&Omega; source driving the input is 667 mV.  That's a large error unlikely to be acceptable.

Another problem with high impedance is low bandwidth.  There will always be some parasitic capacitance.  Let's say for example that the net connected to the two resistors and the inverting input has 10 pF capacitance to ground.  With 667 k&Omega; driving it, you have a low pass filter at only 24 kHz.  That may be acceptable for a audio application, but a serious problem in many other applications.  You might be getting a lot less gain at high frequencies than you expect from the gain-bandwidth product of the opamp and the feedback gain.

As with everything in engineering, it's a tradeoff.  You have two degrees of freedom in chosing the two resistors.  The gain you want only nails down one degree.  You have to trade off the current requirements and output impedance to decide the second.