#include<bits/stdc++.h>
using namespace std;

const int MAXN = 110;
int n, m, ex, ey;
int dp[2][MAXN][MAXN][MAXN];
int C[MAXN][MAXN], R[MAXN][MAXN];
char s[MAXN][MAXN];

inline int QR(int p, int l, int r) {
	if(l >= r) return 0;
	return R[p][r]-R[p][l];
}

inline int QC(int p, int l, int r) {
	if(l >= r) return 0;
	return C[p][r]-C[p][l];
}

inline void chkmax(int &cur, int val) {
	if(cur < val) cur = val;
}

int main() {
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; i++) scanf("%s", s[i]+1);
	for(int i = 1; i <= n; i++) {
		C[i][0] = 0;
		for(int j = 1; j <= m; j++) {
			C[i][j] = C[i][j-1]+(s[i][j]=='o');
			if(s[i][j] == 'E') ex = i, ey = j;
		}
	}
	for(int i = 1; i <= m; i++) {
		R[i][0] = 0;
		for(int j = 1; j <= n; j++) 
			R[i][j] = R[i][j-1]+(s[j][i]=='o');
	}

	for(int l = 0; l < ex; l++) {
		for(int d = 0; d < ey; d++) 
			for(int r = 0; r <= n-ex; r++) 
				for(int u = 0; u <= m-ey; u++) {
					int val = dp[l&1][d][r][u];
					if(l != ex-1) {
						if(ex-l-1 <= r) chkmax(dp[l&1^1][d][r][u], val);
						else {
							int lef = max(ey-d, u+1), rig = min(ey+u, m-d);
							chkmax(dp[l&1^1][d][r][u], val+QC(ex-l-1, lef-1, rig));
						}
					}
					if(d != ey-1) {
						if(ey-d-1 <= u) chkmax(dp[l&1][d+1][r][u], val);
						else {
							int lef = max(ex-l, r+1), rig = min(ex+r, n-l);
							//if(d == 0 && r == 1 && u == 1) printf("!\n");
							chkmax(dp[l&1][d+1][r][u], val+QR(ey-d-1, lef-1, rig));
						}
					}
					if(r != n-ex) {
						if(ex+r+1 > n-l) chkmax(dp[l&1][d][r+1][u], val);
						else {
							int lef = max(ey-d, u+1), rig = min(ey+u, m-d);
							//if(d == 1 && r == 0 && u == 1) printf("!!\n");
							chkmax(dp[l&1][d][r+1][u], val+QC(ex+r+1, lef-1, rig));
						}
					}
					if(u != m-ey) {
						if(ey+u+1 > m-d) chkmax(dp[l&1][d][r][u+1], val);
						else {
							int lef = max(ex-l, r+1), rig = min(ex+r, n-l);
							//if(d == 1 && r == 1 && u == 0) printf("!!!\n");
							chkmax(dp[l&1][d][r][u+1], val+QR(ey+u+1, lef-1, rig));
						}
					}
				}
		if(l == ex-1) break;
		for(int d = 0; d < ey; d++) 
			for(int r = 0; r <= n-ex; r++) 
				for(int u = 0; u <= m-ey; u++) 
					dp[l&1][d][r][u] = 0;
	}
	printf("%d\n", dp[(ex-1)&1][ey-1][n-ex][m-ey]);
	return 0;
}

#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 201010;

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll ans[110][110];
bool flag[2][110];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll>a(n);
	bool flag = false;
	rep(i, n) {
		cin >> a[i];
		if (a[i] >= k)flag = true;
	}
	ll res = a[0];
	rep(i, n - 1) {
		res = gcd(res, a[i + 1]);
	}
	sort(a.begin(), a.end());
	if (flag == false) {
		puts("IMPOSSIBLE");
		return 0;
	}
	else {
		if (k % res) {
			puts("IMPOSSIBLE");
		}
		else {
			puts("POSSIBLE");
		}
	}
	return 0;
}