Link to this code: https://cses.fi/paste/66d203bbff2eaef4944f12/
#include <bits/stdc++.h> 
using namespace std;  

typedef long long ll;  
typedef pair<int, int> ii;  

const int N = 2e5 + 5;   

int n;
ll t; 
int k[N]; 

bool check(ll mid) {
	ll tot = 0;   
	for (int i = 1; i <= n; i++) {
		tot += mid / k[i]; 
		tot = min(tot, t);  
	}
	return (tot >= t); 
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);  	
	cin >> n >> t; 
	for (int i = 1; i <= n; i++) cin >> k[i];   

	ll l = 1, r = 1e18, ans = -1;   
	while (l <= r) {
		ll mid = (l + r) >> 1; 
		
		if (check(mid)) {
			ans = mid;   
			r = mid - 1;  
		}
		else {
			l = mid + 1; 
		}
	}

	cout << ans << '\n'; 
}