#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t > 0) {
    long long n, d;
    cin >> n >> d;
    long long a[n], b[n];
    long long k = 0;
    long long e = 0;
    long long ans = 0;
    long long f;
    for (long long i = 0; i < n; i++) {
      cin >> a[i] >> b[i];
      long long c = a[i] - b[i];
      if (k < c) {
        k = c;
        f = i;
      }
    }
    for (long long i = 0; i < n; i++) {
      if (a[i] > b[i]) {
        e = 1;
        break;
      }
    }
    if (e == 0 && d > *max_element(a, a + n)) {
      cout << -1 << endl;
    } else {
      long long o = *max_element(a, a + n);
      if (d <= o)
        cout << 1 << endl;
      else {
        ans = (d - o) / k;
        if (d - ans * k > o) ans++;
        cout << ans + 1 << endl;
      }
    }
    t--;
  }
}
