#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
long long binpow(long long base, long long exp, int mod) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base) % mod;
    exp = exp >> 1;
    base = (base * base) % mod;
  }
  return res;
}
long long mod(long long x) {
  return ((x % 1000000007LL + 1000000007LL) % 1000000007LL);
}
long long add(long long a, long long b) { return mod(mod(a) + mod(b)); }
long long mul(long long a, long long b) { return mod(mod(a) * mod(b)); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    long long int maxdiff = -1e18;
    long long int maxele = -1e18;
    for (int i = 0; i < n; i++) {
      long long int l, r;
      cin >> l >> r;
      maxdiff = max(maxdiff, l - r);
      maxele = max(maxele, l);
    }
    long long int ans = 1;
    m -= maxele;
    if (m > 0) {
      if (maxdiff <= 0) {
        ans = -1;
      } else {
        ans += (m + maxdiff - 1) / maxdiff;
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
