import java.io.*;
import java.util.*;

public class ss{

	BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer st = new StringTokenizer("");
	
	public boolean run() throws IOException{
		int n = nextInt();
		if (n != 0){
				
				int m = nextInt();
				int p[] = new int[n];
				for(int i = 0; i < n;i++){
					p[i] = nextInt();		
				}
				int i = 0, max = 0,pocet = 0,zv = 0;
				while(i != (n - 1)){
					if ((int)(m/p[i]) > pocet){
						pocet = (int)(m/p[i]);
						zv = m % pocet;
					}						
					if (max < (p[i+1]*pocet + zv)) max = p[i+1]*pocet + zv;
					i++;			
				}
				if (n == 1)System.out.println(m); 
				else if ((max - m) <= 0) System.out.println(0); 
				else System.out.println(max - m);
				return true;
		}else return false;
	}

	public String nextToken() throws IOException{
		while(!st.hasMoreTokens()) st = new StringTokenizer(stdin.readLine());
		return st.nextToken();
	}

	public int nextInt() throws IOException{
		return Integer.parseInt(nextToken());	
	}	

	public static void main(String[] argv) throws IOException{
		ss m = new ss();	
		while(m.run()){}
	}
}
