#include <bits/stdc++.h>
using namespace std;
int n, m, l, r, maxx, ans, a[500010], p[500010][30];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &l, &r), a[l] = max(a[l], r), maxx = max(maxx, r);
  for (int i = 0; i <= maxx; i++)
    a[i] = max(a[i], a[max(0, i - 1)]), p[i][0] = a[i];
  for (int i = 1; i <= 20; i++)
    for (int j = 0; j <= maxx; j++) p[j][i] = p[p[j][i - 1]][i - 1];
  while (m--) {
    scanf("%d%d", &l, &r), ans = 1;
    for (int i = 20; i >= 0; i--)
      if (p[l][i] < r) ans += (1 << i), l = p[l][i];
    printf("%d\n", (a[l] >= r) ? (ans) : (-1));
  }
  return 0;
}
