#include <bits/stdc++.h>

#define reg register
#define pr std::pair<int, int>
#define fi first
#define se second
#define FIN(s) freopen(s, "r", stdin)
#define FOUT(s) freopen(s, "w", stdout)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, l, r) for (int i = l; i <= r; ++i)
#define lep(i, l, r) for (int i = l; i < r; ++i)
#define irep(i, r, l) for (int i = r; i >= l; --i)
#define ilep(i, r, l) for (int i = r; i > l; --i)
#define Rep(i, n) rep(i, 1, n)
#define Lep(i, n) lep(i, 1, n)
#define IRep(i, n) irep(i, n, 1)
#define ILep(i, n) ilep(i, n, 1)
typedef long long ll;
typedef long double ld;

namespace modular {
    const int MOD = 1000000007;
    inline int add(int x, int y) { return (x += y) >= MOD ? x -= MOD : x; }
    inline void inc(int &x, int y) { (x += y) >= MOD ? x -= MOD : 0; }
    inline int mul(int x, int y) { return 1LL * x * y % MOD; }
    inline int qpow(int x, int y) {
        int ans = 1;
        for (; y; y >>= 1, x = mul(x, x))
            if (y & 1) ans = mul(ans, x);
        return ans;
    }
};  // namespace modular
using namespace modular;

namespace Base {
    template <typename Tp>
    inline Tp input() {
        Tp x = 0, y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-') y = -1;
            c = getchar();
        }
        if (c == EOF) return 0;
        while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar();
        return x *= y;
    }
    template <typename Tp>
    inline void read(Tp &x) {
        x = input<Tp>();
    }
    template <typename Tp>
    inline void chmax(Tp &x, Tp y) {
        x < y ? x = y : 0;
    }
    template <typename Tp>
    inline void chmin(Tp &x, Tp y) {
        x > y ? x = y : 0;
    }
};  // namespace Base
using namespace Base;
/*----------------------------------------------------------------------------*/

#define MAX_N 400007

int N, M, top;
int a[MAX_N], b[MAX_N], lasx[MAX_N], las[MAX_N];

struct P {
    int x, y;
    bool operator<(const P &rhs) const {
        return x == rhs.x ? y < rhs.y : x < rhs.x;
    }
    bool operator==(const P &rhs) const { return x == rhs.x && y == rhs.y; }
} p[MAX_N];

int bit[MAX_N], cans[MAX_N];
inline int lowbit(int x) { return x & -x; }
void modi(int x, int val) {
    while (x <= top) inc(bit[x], val), x += lowbit(x);
}
int query(int x) {
    int ans = 0;
    while (x) inc(ans, bit[x]), x ^= lowbit(x);
    return ans;
}

int mx[MAX_N], f[MAX_N];
void solve() {
    p[++top] = (P){0, 0};
    int tmp = 0;
    Rep(i, top) a[++tmp] = p[i].x;
    std::sort(a + 1, a + tmp + 1);
    tmp = std::unique(a + 1, a + tmp + 1) - a - 1;
    Rep(i, top) p[i].x = std::lower_bound(a + 1, a + tmp + 1, p[i].x) - a;
    tmp = 0;
    Rep(i, top) a[++tmp] = p[i].y;
    std::sort(a + 1, a + tmp + 1);
    tmp = std::unique(a + 1, a + tmp + 1) - a - 1;
    Rep(i, top) p[i].y = std::lower_bound(a + 1, a + tmp + 1, p[i].y) - a;
    std::sort(p + 1, p + top + 1);
    top = std::unique(p + 1, p + top + 1) - p - 1;
    // Rep(i, top) printf("%d %d\n", p[i].x, p[i].y);
    Rep(i, top) {
        las[i] = lasx[p[i].y];
        chmax(mx[p[i].y], p[i].x);
        lasx[p[i].y] = i;
    }
    // Rep(i, top) printf("%d ", las[i]);
    // puts("");
    modi(1, 1);
    int res = 1, sum = 1, cur = 2;
    rep(i, 2, top) {
        int val = query(p[i].y);
        f[i] = val;
        if (p[i].x != p[i + 1].x) {
            rep(j, cur, i) {
                modi(p[j].y, (MOD - cans[p[j].y]) % MOD);
                modi(p[j].y, f[j]);
                cans[p[j].y] = f[j];
            }
            cur = i + 1;
        }
        // printf("%d %d %d\n", p[i].x, p[i].y, val);
        if (mx[p[i].y] == p[i].x) inc(res, val);
    }
    printf("%d\n", res);
}

int main() {
    read(N), read(M);
    Rep(i, N) read(a[i]);
    Rep(i, M) read(b[i]);
    int l = 0;
    Rep(i, N) {
        while (l < M && b[l + 1] < a[i]) l++;
        if (l) p[i].x = a[i] - b[l];
    }
    l = M + 1;
    IRep(i, N) {
        while (l > 1 && b[l - 1] > a[i]) l--;
        if (l <= M) p[i].y = b[l] - a[i];
    }
    Rep(i, N) if (p[i].x && p[i].y) p[++top] = p[i];
    solve();
    return 0;
}


Measured memory_bytes: 13440