#include <bits/stdc++.h>
using namespace std;
int n, m, tmp1, tmp2, x[1000010], y[1000010];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d", &n, &m), tmp1 = tmp2 = -1000000000;
    for (int i = 1; i <= n; i++) scanf("%d%d", &x[i], &y[i]);
    for (int i = 1; i <= n; i++)
      tmp1 = max(tmp1, x[i] - y[i]), tmp2 = max(tmp2, x[i]);
    if (tmp1 <= 0 && m > tmp2)
      printf("-1\n");
    else if (tmp1 <= 0 && m <= tmp2)
      printf("1\n");
    else if (m <= tmp2)
      printf("1\n");
    else
      printf("%d\n", (m - tmp2) / tmp1 + ((m - tmp2) % tmp1 ? 1 : 0) + 1);
  }
}
