#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int lim = 5e5;
const int logn = 21;
int n, m;
int go[lim + 5];
int rmq[maxn][logn];
struct line {
  int l, r;
  bool operator<(const line& other) const { return l < other.l; }
  bool operator==(const line& other) const {
    return (l == other.l) && (r == other.r);
  }
} lines[maxn];
void ReadInput() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> lines[i].l >> lines[i].r;
  sort(lines + 1, lines + n + 1);
}
void Optimize() {
  int cur = 1;
  fill(begin(go), end(go), -1);
  pair<int, int> mx(-1, -1);
  for (int pos = 0; pos <= lim; ++pos) {
    while (cur <= n && lines[cur].l == pos) {
      mx = max(mx, make_pair(lines[cur].r, cur));
      ++cur;
    }
    if (mx.first >= pos) go[pos] = mx.second;
  }
  fill_n(&rmq[0][0], sizeof(rmq) / sizeof(rmq[0][0]), -1);
  for (int i = 1; i <= n; ++i)
    rmq[i][0] = lines[go[lines[i].r]] == lines[i] ? -1 : go[lines[i].r];
  for (int k = 1; k < logn; ++k)
    for (int i = 1; i <= n; ++i)
      if (rmq[i][k - 1] != -1) rmq[i][k] = rmq[rmq[i][k - 1]][k - 1];
}
void Solve() {
  for (; m > 0; --m) {
    int first, second;
    cin >> first >> second;
    int cur = go[first];
    if (cur == -1) {
      cout << "-1\n";
      continue;
    }
    int ans = 1;
    for (int k = logn - 1; k >= 0; --k)
      if (rmq[cur][k] != -1 && lines[rmq[cur][k]].r < second) {
        cur = rmq[cur][k];
        ans += (1 << k);
      }
    if (lines[cur].r >= second) {
      cout << ans << '\n';
      continue;
    }
    if (rmq[cur][0] != -1 && lines[rmq[cur][0]].r >= second)
      ++ans;
    else {
      cout << "-1\n";
      continue;
    }
    cout << ans << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ReadInput();
  Optimize();
  Solve();
}
