#include using namespace std; int arr[70707]; int main() { int d,m; while(cin >> d, d) { cin >> m; int max = 0; for(int i=0; i> arr[i]; } int have = 0; int price = 99999; for(int i=0; i max) max = profit - have*price; if(arr[i]