#include <bits/stdc++.h>
using namespace std;
struct node {
  int l, r;
} a[200005], b[200005];
bool operator<(node tx, node ty) { return tx.l < ty.l; }
bool cmp(node tx, node ty) {
  return tx.l < ty.l || (tx.l == ty.l && tx.r > ty.r);
}
int n, m, top, f[200005][21], t[200005];
int main() {
  int x, y, z, num;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d %d", &a[i].l, &a[i].r);
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++)
    if (b[top].r < a[i].r) b[++top] = a[i], t[top] = a[i].l;
  for (int i = 1; i <= top; i++) a[i] = b[i];
  for (int i = 1; i < top; i++) {
    x = upper_bound(a + 1, a + top + 1, (node){b[i].r, INT_MAX}) - a - 1;
    f[i][0] = x;
    if (b[x].l > a[i].r) f[i][0] = 0;
  }
  b[0].r = INT_MAX;
  z = log2(top);
  for (int j = 1; j <= z; j++) {
    for (int i = 1; i <= top; i++) f[i][j] = f[f[i][j - 1]][j - 1];
  }
  while (m--) {
    scanf("%d %d", &x, &y);
    if (x < b[1].l) {
      printf("-1\n");
      continue;
    }
    num = 0;
    x = upper_bound(t + 1, t + top + 1, x) - t - 1;
    if (b[x].r < y) num++;
    for (int j = z; j >= 0; j--)
      if (b[f[x][j]].r < y) x = f[x][j], num += (1 << j);
    if (b[x].r < y && (!f[x][0] || b[f[x][0]].r < y))
      printf("-1\n");
    else
      printf("%d\n", num + 1);
  }
  return 0;
}
