#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 13;
const int L = 18;
pair<int, int> a[N];
int to[N];
int dp[L][N];
int n, q;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    a[i] = {l, r};
  }
  sort(a, a + n);
  int j = 0;
  pair<int, int> mx = {0, -1};
  for (int i = 0; i < N; i++) {
    while (j < n && a[j].first == i) {
      mx = max(mx, {a[j].second, j++});
    }
    if (mx.first <= i)
      to[i] = -1;
    else
      to[i] = mx.second;
  }
  for (int i = 0; i < n; i++) {
    dp[0][i] = to[a[i].second];
  }
  for (int i = 1; i < L; i++) {
    for (int j = 0; j < N; j++) {
      if (dp[i - 1][j] == -1)
        dp[i][j] = -1;
      else
        dp[i][j] = dp[i - 1][dp[i - 1][j]];
    }
  }
  while (q--) {
    int ans = 1;
    int l, r;
    cin >> l >> r;
    int x = to[l];
    if (x == -1) {
      cout << -1 << "\n";
      continue;
    }
    for (int i = L - 1; i >= 0; i--) {
      int k = dp[i][x];
      if (k == -1) continue;
      if (a[k].second < r) {
        ans += 1 << i;
        x = k;
      }
    }
    if (a[x].second >= r)
      cout << ans << "\n";
    else if (dp[0][x] == -1)
      cout << -1 << "\n";
    else
      cout << ans + 1 << "\n";
  }
}
