#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a-1) ; i>=(b);i--)
#define rep(i,n) FOR(i,0,n)
#define PB push_back
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FILL(a, value) memset(a, value, sizeof(a))
typedef long long LL ;
typedef long long Int ;
typedef vector<int > VI ;
typedef vector<LL > VL;
typedef pair<int,int > PII;
const LL LINF = 1e18 +47;
const int INF = 1e9 +47 ;
const int MOD = 1e9 + 7;
const double EPS = 1e-5;
const int MAX = 2*1000*100 + 47;
struct point {
LL x, y;
point() {}
point(LL x, LL y) : x(x), y(y) {};
point operator-(const point& p)const {
return point (x - p.x, y - p.y);
}
point operator+(const point& p)const {
return point (x + p.x, y + p.y);
}
LL operator*(const point & p) const {
return x * p.y - y * p.x;
}
point operator*(LL k) const {
return point(x * k, y * k);
}
};
long long sign(LL x) {
if (!x) return 0;
return x > 0 ? 1 : -1;
}
bool triangleContains(const point& a, const point& b, const point& c, const point& p)
{
int s1 = sign((b - a) * (p - a));
int s2 = sign((c - b) * (p - b));
int s3 = sign((a - c) * (p - c));
return (s1 >= 0 && s2 >= 0 && s3 >= 0) || (s1 <= 0 && s2 <= 0 && s3 <= 0);
}
point P[MAX];
point V[MAX];
int n;
bool contains(const point& q) {
if (abs(q.x) > INF || abs(q.y) > INF)
return 0;
int l = 1, r = n - 1;
int s1 = sign((P[l] - P[0]) * (q - P[0]));
int s2 = sign((P[r] - P[0]) * (q - P[0]));
if (s1 <= 0) return 0;
if (s2 >= 0) return 0;
while (r - l > 1) {
int m = (l + r) / 2;
int s = sign((P[m] - P[0]) * (q - P[0]));
if (s <= 0) r = m;
else l = m;
}
return triangleContains(P[0], P[l], P[r], q) && ((P[r] - q) * (P[l]-q) != 0);
}
int main() {
scanf("%d", &n);
int m;
scanf("%d", &m);
FOR(i, 0, n) {
scanf("%lld%lld", &P[i].x, &P[i].y);
P[i + n] = P[i];
}
point tot(0, 0);
FOR(i, 0, m) {
scanf("%lld%lld", &V[i].x, &V[i].y);
tot = tot + V[i];
}
PII mn = {INF, -1};
point pos(0, 0);
FOR(i, 0, m) {
if (!contains(pos)) {
mn = min(mn, {0, i});
pos = pos + V[i];
break;
}
if (tot.x != 0 || tot.y != 0) {
Int l = 0;
Int r = LINF / max(abs(tot.x), abs(tot.y));
while (r - l > 1) {
Int m = (l + r) / 2;
if (contains(pos + tot * m)) {
l = m;
} else {
r = m;
}
}
mn = min(mn, {r, i});
}
pos = pos + V[i];
}
if (mn.first == INF) {
cout << -1 << endl;
return 0;
}
cout << (Int)mn.first * m + mn.second - 1 << endl;
return 0;
}