#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
mt19937 rnd(time(0));
const int N = 2e5 + 10, P1 = 337, P2 = 239, INF = 1e9, P = 20;
struct Segment {
  int l, r, num;
  Segment() { l = r = num = 0; }
  Segment(int l, int r, int num) {
    this->l = l;
    this->r = r;
    this->num = num;
  }
};
Segment segments[N], cpy[N], q[N];
vector<int> tree[N];
int ans[N], pr[N], h[N], a[N];
bool used[N];
int binups[N][P];
bool cmp(Segment a, Segment b) { return a.r < b.r; }
bool cmp1(Segment a, Segment b) { return a.l < b.l; }
void dfs(int v) {
  if (pr[v] == -1) {
    binups[v][0] = v;
  } else {
    binups[v][0] = pr[v];
  }
  for (int i = 1; i < P; i++) {
    binups[v][i] = binups[binups[v][i - 1]][i - 1];
  }
  for (auto to : tree[v]) {
    h[to] = h[v] + 1;
    dfs(to);
  }
}
int query(int v, int x) {
  if (a[v] >= x) {
    return 1;
  }
  int st = v;
  for (int i = P - 1; i >= 0; i--) {
    if (a[binups[v][i]] < x) {
      v = binups[v][i];
    }
  }
  v = binups[v][0];
  if (a[v] >= x) {
    return h[st] - h[v] + 1;
  } else {
    return -1;
  }
}
void solve() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    pr[i] = -1;
    cin >> segments[i].l >> segments[i].r;
    segments[i].num = i;
    cpy[i] = segments[i];
  }
  sort(segments, segments + n, cmp);
  sort(cpy, cpy + n, cmp1);
  int ptr = 0, mx = -1, num = -1;
  for (int i = 0; i < n; i++) {
    while (ptr < n && cpy[ptr].l <= segments[i].r) {
      if (mx < cpy[ptr].r) {
        mx = cpy[ptr].r;
        num = cpy[ptr].num;
      }
      ptr++;
    }
    if (mx > segments[i].r) {
      tree[num].push_back(segments[i].num);
      pr[segments[i].num] = num;
    }
    a[segments[i].num] = segments[i].r;
  }
  for (int i = 0; i < n; i++) {
    if (pr[i] == -1) {
      dfs(i);
    }
  }
  for (int i = 0; i < m; i++) {
    cin >> q[i].l >> q[i].r;
    q[i].num = i;
  }
  sort(q, q + m, cmp1);
  ptr = 0;
  mx = -1;
  num = -1;
  for (int i = 0; i < m; i++) {
    ans[q[i].num] = -1;
    while (ptr < n && cpy[ptr].l <= q[i].l) {
      if (mx < cpy[ptr].r) {
        mx = cpy[ptr].r;
        num = cpy[ptr].num;
      }
      ptr++;
    }
    if (mx > q[i].l) {
      ans[q[i].num] = query(num, q[i].r);
    }
  }
  for (int i = 0; i < m; i++) {
    cout << ans[i] << "\n";
  }
}
signed main() {
  ios::sync_with_stdio();
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
