#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ((void)0);
  ((void)0);
  ((void)0);
  int T, N, M1, M2, s, e;
  long long X;
  for (cin >> T; T--;) {
    M1 = M2 = 0x7fffffff;
    s = 0;
    e = 1e9;
    for (cin >> N >> X; N--;) {
      int d, h;
      cin >> d >> h;
      M1 = min(M1, -d);
      M2 = min(M2, h - d);
    }
    if (X + M1 <= 0) {
      cout << "1\n";
      continue;
    }
    while (s <= e) {
      int m = (s + e) >> 1;
      if (X + 1LL * m * M2 + M1 <= 0)
        e = m - 1;
      else
        s = m + 1;
    }
    if (s > 1e9)
      cout << "-1\n";
    else
      cout << s + 1 << '\n';
  }
  return 0;
}
