#include <bits/stdc++.h>
using ll = long long;
using namespace std;
struct line {
float k, b;
bool operator<(const line &other) const {
if (k == other.k) return b < other.b;
return k < other.k;
}
};
struct pudge {
ll x, y, i;
bool operator<(const pudge &other) const {
if (x == other.x) return y < other.y;
return x < other.x;
}
};
void sol() {
ll n, m; cin >> n >> m;
vector<pudge> p(n);//координаты
vector<bool> alive(n), dang(n);//dang = 1 - есть крюк
for (int i = 0; i < n; i++) {
cin >> p[i].x >> p[i].y;
p[i].i = i;
alive[i] = 1;
dang[i] = 1;
}
map<line, set<pudge>> mp;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
ll x1 = p[i].x, y1 = p[i].y; //делаем прямую
ll x2 = p[j].x, y2 = p[j].y;
float k, b;
if (x1 == x2) {
k = 1e18, b = x1;
} else {
k = (float)(y2 - y1) / (x2 - x1);
b = (float)y1 - k * x1;
}
mp[{k, b}].insert({x1, y1, i});
mp[{k, b}].insert({x2, y2, j});
}
}
while (m--) {
ll at, def; cin >> at >> def; at--; def--;
if (dang[at] == 0 || alive[at] == 0) continue;//атакующий метв/безоружен идем дальше
ll x1 = p[at].x, y1 = p[at].y;
ll x2 = p[def].x, y2 = p[def].y;
float k, b; //делаем прямую
if (x1 == x2) {
k = 1e18, b = x1;
} else {
k = (float)(y2 - y1) / (x2 - x1);
b = (float)y1 - k * x1;
}
set<pudge> points = mp[{k, b}];
auto it = points.find({x1, y1});
if (x1 < x2 || (x1 == x2 && y1 < y2)) { //в каком направлении крюк летел?
it++;
while (it != points.end()) {
pudge pud = *it;
if (alive[pud.i] == 1) {
alive[pud.i] = 0;
break;
}
it++;
}
if (it == points.end()) dang[at] = 0;
}
else if (x1 > x2 || (x1 == x2 && y1 > y2)) { //аналогично только назад
it--;
while (it != points.begin()) {
pudge pud = *it;
if (alive[pud.i] == 1) {
alive[pud.i] = 0;
break;
}
it--;
}
if (it == points.begin()) {
pudge pud = *it;
if (alive[pud.i] == 0) dang[at] = 0;
else alive[pud.i] = 0;
}
}
}
ll sz = 0;
for (auto i : alive) sz += i;
cout << sz << '\n';
for (int i = 0; i < n; i++) {
if (alive[i] == 1) cout << i + 1 << " ";
}
}
int main() {
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0);
ll t = 1;
//cin >> t;
while (t--) sol();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIGxsID0gbG9uZyBsb25nOwp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IGxpbmUgewoJZmxvYXQgaywgYjsKCWJvb2wgb3BlcmF0b3I8KGNvbnN0IGxpbmUgJm90aGVyKSBjb25zdCB7CiAgICAgICAgaWYgKGsgPT0gb3RoZXIuaykgcmV0dXJuIGIgPCBvdGhlci5iOwogICAgICAgIHJldHVybiBrIDwgb3RoZXIuazsKICAgIH0KfTsKc3RydWN0IHB1ZGdlIHsKCWxsIHgsIHksIGk7Cglib29sIG9wZXJhdG9yPChjb25zdCBwdWRnZSAmb3RoZXIpIGNvbnN0IHsKCQlpZiAoeCA9PSBvdGhlci54KSByZXR1cm4geSA8IG90aGVyLnk7CiAgICAgICAgcmV0dXJuIHggPCBvdGhlci54OwogICAgfQp9OwoKdm9pZCBzb2woKSB7CglsbCBuLCBtOyBjaW4gPj4gbiA+PiBtOwoJdmVjdG9yPHB1ZGdlPiBwKG4pOy8v0LrQvtC+0YDQtNC40L3QsNGC0YsKCXZlY3Rvcjxib29sPiBhbGl2ZShuKSwgZGFuZyhuKTsvL2RhbmcgPSAxIC0g0LXRgdGC0Ywg0LrRgNGO0LoKCWZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CgkJY2luID4+IHBbaV0ueCA+PiBwW2ldLnk7CgkJcFtpXS5pID0gaTsKCQlhbGl2ZVtpXSA9IDE7CgkJZGFuZ1tpXSA9IDE7Cgl9CgltYXA8bGluZSwgc2V0PHB1ZGdlPj4gbXA7Cglmb3IgKGludCBpID0gMD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