#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
struct node {
  int l, r;
} x[500010];
int cmp(node a, node b) { return a.r > b.r; }
int f[500010][22];
int l = 1e9, r = 0;
void init() {
  for (int k = 1; k <= 20; k++)
    for (int i = l; i <= r; i++) f[i][k] = f[f[i][k - 1]][k - 1];
}
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> x[i].l >> x[i].r;
    l = min(l, x[i].l);
    r = max(r, x[i].r);
  }
  sort(x + 1, x + 1 + n, cmp);
  int now = r;
  f[r][0] = r;
  for (int i = 1; i <= n; i++) {
    if (x[i].l >= now) continue;
    for (int j = x[i].l; j < min(now, x[i].r + 1); j++) f[j][0] = x[i].r;
    now = x[i].l;
  }
  init();
  int ql, qr;
  for (int i = 1; i <= m; i++) {
    cin >> ql >> qr;
    int ans = 0;
    if (f[ql][20] < qr)
      cout << -1 << endl;
    else {
      for (int j = 20; j >= 0; j--) {
        if (f[ql][j] >= qr && j != 0) continue;
        if (f[ql][j] < qr) ans += pow(2, j);
        ql = f[ql][j];
        if (j == 0) {
          ans++;
          continue;
        }
      }
      cout << ans << endl;
    }
  }
}
