#include <bits/stdc++.h>
const int N = 5e5 + 5, logN = 18 + 1;
int n, m, f[N][logN];
int query(int l, int r) {
  int ans = 0;
  for (int i = logN - 1; i >= 0; i--) {
    if (f[l][i] < r) l = f[l][i], ans += (1 << i);
  }
  l = f[l][0], ans++;
  return l >= r ? ans : -1;
}
int main() {
  scanf("%d%d", &n, &m);
  int mx = 0;
  for (int i = 1; i <= n; i++) {
    int l, r;
    scanf("%d%d", &l, &r), l++, r++;
    f[l][0] = std::max(f[l][0], r);
    mx = std::max(mx, r);
  }
  for (int i = 1; i <= mx; i++) {
    f[i][0] = std::max(f[i][0], std::max(i, f[i - 1][0]));
  }
  for (int j = 1; j < logN; j++) {
    for (int i = 1; i <= mx; i++) {
      f[i][j] = f[f[i][j - 1]][j - 1];
    }
  }
  for (int i = 1; i <= m; i++) {
    int l, r;
    scanf("%d%d", &l, &r), l++, r++;
    printf("%d\n", query(l, r));
  }
  return 0;
}
