import java.io.*; import java.util.Scanner; public class ss { public static int fact(int n) { int r = 0; n --; while(n > 0) { r += n; n --; } return r; } public static void main(String args[]) throws IOException { Scanner sc = new Scanner(System.in); int i; int days = 0, money = 0; while((i = sc.nextInt()) != 0) { days = i; money = sc.nextInt(); int tmp = 0; int[] prices = new int[days]; float maxRatio = 0; int maxRatioJ = 0; int maxRatioK = 0; boolean ok = false; while(tmp < days) { prices[tmp] = sc.nextInt(); // System.out.println("prices[tmp]: " + prices[tmp] + ", prices[maxRatioJ]: " + prices[maxRatioJ] + ", prices[maxRatioK]" + prices[maxRatioK]); if(tmp > 0 && (prices[tmp] < prices[maxRatioJ] || prices[tmp] > prices[maxRatioK] || ok)) { if(prices[tmp] < prices[maxRatioJ]) { ok = true; } else { for(int j = 0; j < tmp; j ++) { if((float)prices[tmp] / (float)prices[j] > maxRatio) { maxRatio = (float)prices[tmp] / (float)prices[j]; maxRatioJ = j; maxRatioK = tmp; ok = false; } } } } tmp ++; } if(maxRatio > 1) { int count = money / prices[maxRatioJ]; int cash = money % prices[maxRatioJ]; int sell = count * prices[maxRatioK]; System.out.println(sell - money + cash); } else { System.out.println("0"); } } // for(int j = 0; j < ratios.length; j ++) { // System.out.println("ratios[" + j + "] = " + ratios[j] + ""); // } } }