#include using namespace std; const int N = 110; int n, k; int w[N], h[N]; /* 2 6 4 3 5 4 答案: 2 */ int main() { cin >> n >> k; for (int i = 1; i <= n; i++) cin >> w[i] >> h[i]; for (int i = 1;; i++) { int cnt = 0; for (int j = 1; j <= n; j++) cnt += (w[j] / i) * (h[j] / i); if (cnt == k) { cout << i << endl; return 0; } if (cnt < k) { cout << -1 << endl; return 0; } } return 0; }