#include #include using namespace std; int main() { int tests, k, i, j; int num[1000], den[1000]; while (cin >> tests >> k) { if (tests == 0 && k == 0) return 0; for (i = 0; i < tests; i++) cin >> num[i]; for (i = 0; i < tests; i++) cin >> den[i]; double scores[1000]; double lb = 0, ub = 1; for (i = 0; i < 100; i++) { double x = (lb+ub)/2; for (j = 0; j < tests; j++) scores[j] = num[j] - x*den[j]; sort(scores, scores+tests); double total = 0; for (j = k; j < tests; j++) total += scores[j]; if (total >= 0) lb = x; else ub = x; } cout << int(100*lb + 0.5) << endl; } }