#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  cin >> t;
  for (long long int i = 0; i < t; i++) {
    long long int n, x;
    cin >> n >> x;
    long long int mx = LLONG_MIN;
    long long int mx1 = 0;
    pair<long long int, long long int> mxp = {0, 0};
    for (long long int i = 0; i < n; i++) {
      long long int a, b;
      cin >> a >> b;
      mx1 = max(a, mx1);
      if (a - b > mx) {
        mx = a - b;
        mxp = {a, b};
      }
    }
    if (mx <= 0) {
      if (x <= mx1) {
        cout << 1 << "\n";
      } else {
        cout << -1 << "\n";
      }
      continue;
    }
    long long int a = mxp.first;
    long long int b = mxp.second;
    long long int ans = max(0ll, (x - mx1) / mx);
    x -= (ans * mx);
    while (x > mx1) {
      ans++;
      x -= a;
      x += b;
    }
    if (x > 0 && x <= mx1) ans++;
    cout << ans << "\n";
  }
  return 0;
}
