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; while(tmp < days) { prices[tmp] = sc.nextInt(); if(tmp > 0 && (prices[tmp] < maxRatioJ || prices[tmp] > maxRatioK)) { 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; } } } 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] + ""); // } } }