#include "bits/stdc++.h"
const int N = 110;
int n, m;
int f[N][N];
int a[N], b[N];
// f[i, j]: 第 i 个积木,枚举到横坐标 j 时 y_i 的最大值
bool check(int x) {
memset(f, -0x3f, sizeof f);
f[0][0] = 0;
for (int i = 1; i <= n; ++ i)
for (int j = 0; j <= m; ++ j) {
f[i][j] = -1e9;
for (int k = std::max(0, j - x / a[i]); k <= j; ++ k)
f[i][j] = std::max(f[i][j], f[i - 1][k] + (x - a[i] * (j - k)) / b[i]);
}
return f[n][m] >= m;
}
int main() {
freopen("jigsaw.in", "r", stdin);
freopen("jigsaw.out", "w", stdout);
std::cin >> n >> m;
for (int i = 1; i <= n; ++ i) {
std::cin >> a[i] >> b[i];
}
int l = 1, r = 1e7;
while (l < r) {
int mid = l + r >> 1;
if (check(mid)) r = mid;
else l = mid + 1;
}
std::cout << l << '\n';
return 0;
}