#include <iostream>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <complex>
#include <vector>
#include <cmath>
using namespace std;

#define EPS 1e-7
#define INF 360
#define PI M_PI


int N, M;

typedef complex<double> Point;

namespace std{
	bool operator < (const Point &a, const Point &b){
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
	Point operator / (const Point &p, const double &a){
		return Point(real(p)/a, imag(p)/a);
	}
	Point operator * (const Point &p, const double &a){
		return Point(real(p) * a, imag(p)*a);
	}
	bool operator == (const Point &a, const Point &b){
		return real(a) == real(b) && imag(a) == imag(b);
	}
}
typedef vector<Point> Polygon;
struct Line : public vector<Point>{
	Line(){}
	Line (const Point &a, const Point &b){
		push_back(a); push_back(b);
	}
};
struct Circle{
	Point c; double r;
	Circle(){}
	Circle(const Point &c, double r) : c(c), r(r){}
};

double distancePP(const Point &a, const Point &b){
	return sqrt((real(a)-real(b))*(real(a)-real(b)) + (imag(a)-imag(b))*(imag(a)-imag(b)));
}

double cross(const Point &a, const Point &b){
	return imag(conj(a)*b);
}

double dot(const Point &a, const Point &b){
 return real(conj(a) * b);
}

Point projection(const Line &l, const Point &p){
	double t = dot(p-l[0], l[0] - l[1]) / norm(l[0]-l[1]);
	return l[0] + t*(l[0]-l[1]);
}

vector<Point> crosspointLC(const Line &l, const Circle &c){
	vector<Point> ret;
	Point center = projection(l, c.c);
	double d = abs(center - c.c);
	double t = sqrt(c.r * c.r - d*d);
	if(isnan(t)) return ret;
	Point vect = (l[1] - l[0]);
	vect /= abs(vect);
	ret.push_back(center - vect*t);
	ret.push_back(center + vect * t);
	return ret;
}

bool is_point_on_line(Point a, Point b, Point c) {
	return abs(b-a) + EPS > max(abs(c-a), abs(c-b));
}

double calc(const Point &a, const Point &b, const Point &pp){
	double ta = arg(a-pp);
	double tb = arg(b-pp);
	while (tb < ta + EPS) {
		tb += 2 * M_PI;
	}
	return ((tb - ta)*180/PI);
}

double calc2(const Point &a, const Point &b, const Point &pp){
	double tb = arg(a-pp);
	double ta = arg(b-pp);
	while (tb < ta + EPS) {
		tb += 2 * M_PI;
	}
	return ((tb - ta)*180/PI);
}



int main(void){
	double cx, cy;
	while(cin>>M>>N, M || N){
		Polygon out, in;
		
		for(int i = 0; i < M; i++){
			double x, y;
			cin >> x >> y;
			out.push_back(Point(x, y));
		}
		for(int i = 0; i < N; i++){
			double x, y;
			cin >> x >> y;
			in.push_back(Point(x,y));
		}
		cin >> cx >> cy;
		double min_ans = INF;
		for(int i = 0; i < in.size(); i++){
			Point pp = Point(cx, cy);
			Circle c = Circle(pp, distancePP(pp, in[i]));
			for(int j = 0; j < out.size(); j++){
				Line l = Line(out[(j+1)%out.size()], out[j]);
				vector<Point> cp = crosspointLC(l, c);
				if(cp.empty()) continue;
				double c1 = 360, c2 = 360;
/*
cout << real(in[i]) << ":" << imag(in[i]) << " and "<< real(out[j]) << ":" << imag(out[j]) << " to "<< real(out[j+1]) << ":" << imag(out[j+1])<< endl;
cout << real(cp[0]) << ":" << imag(cp[0]) << " and "<< real(cp[1]) << ":" << imag(cp[1]) << endl;
*/
				if(is_point_on_line(out[(j+1)%out.size()], out[j], cp[0]))
					c1 = calc(in[i], cp[0], pp);
				if(is_point_on_line(out[(j+1)%out.size()], out[j], cp[1]))
					c2 = calc(in[i], cp[1], pp);
//cout << ":" << c1 << " : " << c2 << " : " << min_ans << endl;
				min_ans = min(min_ans, min(c1, c2));
			}
		}
		swap(in, out);
		for(int i = 0; i < in.size(); i++){
			Point pp = Point(cx, cy);
			Circle c = Circle(pp, distancePP(pp, in[i]));
			for(int j = 0; j < out.size(); j++){
				Line l = Line(out[(j+1)%out.size()], out[j]);
				vector<Point> cp = crosspointLC(l, c);
				if(cp.empty()) continue;
				double c1 = 360, c2 = 360;
				if(is_point_on_line(out[(j+1)%out.size()], out[j], cp[0]))
					c1 = calc2(in[i], cp[0], pp);
				if(is_point_on_line(out[(j+1)%out.size()], out[j], cp[1]))
					c2 = calc2(in[i], cp[1], pp);
				min_ans = min(min_ans, min(c1, c2));
			}
		}


		printf("%.9lf\n", min_ans);
	}
	
	
	return 0;
}

Measured memory_bytes: 1356