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; // float[] ratios = new float[1]; while((i = sc.nextInt()) != 0) { days = i; money = sc.nextInt(); // System.out.println("Days: " + days + ", money: " + money); int tmp = 0; int[] prices = new int[days]; while(tmp < days) { prices[tmp] = sc.nextInt(); tmp ++; } //ratios = new float[fact(days)]; int t = 0; float maxRatio = 0; int maxRatioJ = 0; int maxRatioK = 0; for(int j = 0; j < days - 1; j ++) { for(int k = j + 1; k < days; k ++) { if(j < k) { // ratios[t] = (float)prices[k] / (float)prices[j]; } else { // ratios[t] = 0; } if((float)prices[k] / (float)prices[j] > maxRatio) { maxRatio = (float)prices[k] / (float)prices[j]; maxRatioJ = j; maxRatioK = k; } //ratios[t][1] = j; //ratios[t][2] = k; t ++; } } 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] + ""); // } } }